Category: Structural Testing And Code Coverage
-
Code coverage criteria
Whenever we identify a line of code that is not covered, we have to decide how thorough (or rigorous) we want to be when covering that line. Let’s revisit an if statement from the CountWords program. Listing 3.4 An if expression from the CountWords program A developer may decide to only cover the line —in other words, if a test passes through that if line, the developer…
-
Structural testing in a nutshell
Based on what we just did, let me define a simple approach that any developer can follow (see figure 3.4): Figure 3.4 Applying structural testing in a nutshell. Arrows indicate the iterative nature of the process. The diamond represents the moment where the developer decides whether to write the test case. The most important thing…
-
Code coverage, the right way
Consider the following requirement for a small program that counts the number of words in a string that end with either “r” or “s” (inspired by a CodingBat problem. Given a sentence, the program should count the number of words that end with either “s” or “r”. A word ends when a non-letter appears. The…
-
Introduction
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…