Structure testing technology of Reading Notes in the way of Microsoft software testing
2014-07-18
Do we need structure tests?
A Microsoft test demonstrates the effects of structure tests in code coverage:
More than 3000 testers participated in the experiment. The results were consistent in all groups for every 25 people. In this study,
- Script-based testing: the script-based testing based on the style book has achieved a nominal code coverage rate of 83% in the tested program.
- Exploratory Test: Participants are then allowed to perform a total of 5 hours of Exploratory tests 15 minutes per person. Surprisingly, the code coverage rate only increases by 3 percentage points on average.
- Structure testing: however, after the lab participants are able to analyze the running results of the tested (instrumented) Code and design and test using the white box technology, code coverage increased to 91% in less than 20 minutes (this is the maximum actual code coverage that can be achieved without code mutation or fault injection ). At the same time, testers can better explain from the perspective of Cost and Benefit why the remaining 9% of code not covered is not testable.
Shows the code coverage of different testing technologies.
Figure 1 code coverage of different testing technologies
Block Test
This Book classifies block testing, Decision-Making testing, conditional testing, and basic path testing into structure testing technologies. Here we will focus on block testing.
Block overwrite and statement Overwrite
- The statement overwrites the number of statements executed by a program during the test.
- Block overwrites the number of continuous statement groups without branches. The condition statement that causes the control flow to switch to the branch can contain several blocks.
This seems to be a very small difference. However, the distinction between statement testing and block testing is very important. Compared with statement testing, block testing provides better sensitivity to the control process.
? Code block Calculation
Block Test Summary
Block testing is a common method for unit testing:
Advantage: It is very suitable for quick evaluation of basic functions of a function. It is also a valuable technology for tests designed to execute switch/case statements and exception handling program control processes.
Disadvantage: however, block testing is a relatively weak standard in robust structure testing, and it may miss some important branches of the control process. In addition, block testing is easy to ignore some potential problems, especially when we test to improve code coverage rather than carefully analyzing the tested code.