It's almost the end of the world. I don't know if this software test can be summarized before the end of the legend. No matter whether it's the end of the world, the summary of the software test will continue. Now, we will summarize the statement overwrites in logical overwrite.
What is statement overwrite? Literally, every statement in the program code is overwritten and executed at least once. In fact, the meaning is similar. Statement coverage is a relatively weak test standard. It is intended to select enough test cases so that every statement in the program can be executed at least once. The following example uses a small program as an instance, I hope you can understand the ideas in this example.
Program code:
# Include <iostream. h>
Void main ()
{
// Declare Variables
Int A, B, C, A, B, C;
// Prompt and store user input
Cout <"enter an integer :";
Cin>;
Cout <"enter an integer B :";
Cin> B;
Cout <"enter an integer c :";
Cin> C;
// Select Conditions
If (A> 5)
{
A = A *;
Cout <"A> 5, so a = A * A =" <A <Endl;
}
Else
{
A =;
Cout <"A <= 5, so a = A =" <A <Endl;
}
If (B> 10)
{
B = B * B;
Cout <"B> 10, so B = B * B =" <B <Endl;
}
Else
{
B = B;
Cout <"B <= 10, so B =" <B <Endl;
}
If (C> 15)
{
C = C * C;
Cout <"C> 15, so C = C * c =" <C <Endl;
}
Else
{
C = C;
Cout <"C <= 15, so C =" <C <Endl;
}
}
The program flowchart is as follows:
This code is very simple and has a clear idea. After seeing the program flowchart, the idea is clearer, in the two images, the path marked in red indicates the path of the program execution when the conditions E, H, and K are true; the earth yellow path indicates the path of the program execution when the E, H, and K conditions are false. As shown in the figure, all the statements in the code can be executed as long as the two paths are used, so the test cases can be designed accordingly, A test example is provided here:
Test Case 1: A = 6, B = 11, c = 16
Test results:
Test Case 2: A = 5, B = 10, c = 15
Test results:
It can be seen that the test result meets the meaning of the question.Well, we can sum up the statement overwrite to this point. If we say too much, it may be confused with the coverage analysis in the future. If we learn a coverage, we will firmly grasp one.