Before the software test class, see the teacher demonstrated a statistical C language test coverage of the tool, then want to know. NET has the same tool. It happened yesterday to find clover.net, which can help you analyze the code that has been tested.
Here are some of the information about coverage analysis in our software testing lesson:
Coverage analysis is an analysis of the degree of implementation of requirements or the degree of execution of a program.
Coverage analysis consists of two parts, covering analysis based on requirement and structure based coverage analysis. Demand-based coverage analysis is an analysis of the extent to which the test cases are covered by the software requirements to verify that the selected test cases meet the specified requirements coverage criteria. The coverage analysis based on structure is to analyze the coverage degree of test cases to the program, to verify that the selected test cases meet the specified structure coverage criteria.
Statement coverage is the minimum structure coverage requirement. Statement coverage requires a sufficient number of test cases to be designed so that each statement in the program is executed at least once.
The test independent path number of a program module equals the McCabe cyclomatic complexity of the module.
To consider the flowchart shown above, to make it reach statement coverage, simply select:
a=2, B=0, x=3.
But this test is not complete, if and mistakenly written by or, the above statement coverage test can not find.
Decision overlay, also known as Branch overlay, requires that you design enough test cases to make every decision in the program at least once be true and false, that is, every branch in the program executes at least once.
Decision Overlay Test Case
Test Case A B X Path
1 3 0 1 ACD
2 2 1 3 Abe
For the above illustration, two sets of test inputs are designed to reach the decision overlay via Path aces and Abd or path ACD and Abe.
The decision overlay is also incomplete, for example, when the two test cases above failed to check whether the value remained unchanged along the path abd execution.
Conditional coverage requires a sufficient number of test cases to be designed so that each condition in the decision gets a variety of possible results, that is, each condition has at least one true value and one false.
Conditional override test Case
Test Case A B X Path
1 1 0 3 abd
2 2 1 1 abd
For the above picture, to achieve the condition coverage, need a sufficient number of test cases, so that there are a>1, a≤1, B=0, b≠0 at point A, a=2, a≠2, X>1, x≤1 at point B.
The condition coverage is not complete, as can be seen from the above example, the conditional coverage does not guarantee the decision coverage.
Design enough test cases so that all the possible results of each condition in the decision appear at least once, and every possible result of each decision itself appears at least once.
Decision/Condition Override test Case
Test Case A B X Path
1 2 0 4 Ace
2 1 1 1 abd