Code Coverage & Logic Coverage
make sure every executale statement is executed at least once
make sure method every function logic is covered in test
General coverage types in Unit Test:
Branch Coverage
Condition Coverage
- boundary condition
Loop Coverage
- Cover the on time, multiple times and maximum times loop execution.
- Cover zero times and n+1 times loop execution.
Interface Coverage
Logic Path Coverage
Others
- Exception Handing test
- Argument Type Cast test
- Local Variable Usage test
Database operation, three cases should be tested in a unit test.
1. WHERE clause
2. Data definition and operation(INSERT, UPDATE, DELETE)
3. Stored proceedure and function