- Creating test cases based on the code structure
- Combining structural testing and specification-based testing
- Using code coverage properly
- Why some developers (wrongly) dislike code coverage
We discussed using software requirements as the main element to guide the testing. Once specification-based testing is done, the next step is to augment the test suite with the help of the source code. There are several reasons to do so.
First, you may have forgotten a partition or two when analyzing the requirements, and you may notice that while looking at the source code. Second, when implementing code, you take advantage of language constructs, algorithms, and data structures that are not explicit in the documentation. Implementation-specific details should also be exercised to increase the likelihood of ensuring the program’s full correctness.
We learn how to systematically reflect on the source code, see what is being exercised by the test suite we derived with the help of the specification, and what remains to be tested. Using the structure of the source code to guide testing is also known as structural testing. Understanding structural testing techniques means understanding the coverage criteria. The remainder of this explores using code coverage information to gain more confidence that the program works as expected.
Leave a Reply