In software testing, you should be familiar with white-box testing, which is the opposite of black-box testing, as opposed to their name. Black-Box testing is based on input and output testing, regardless of its internal execution, whereas white-box testing is a test that relies on the internal composition of the program.
White-Box testing is also called structural testing, logic-driven testing, or program-based testing. White box testing is generally used to analyze the internal structure of the program. White box test tester can see the inside of the program, so the white box test requires a measure of the program to achieve a certain degree of coverage, and requires all kinds of software components to be tested, and white-box testing of the good standards will be the program of a certain component is tested to judge, which is also known as the coverage-based testing technology.
White-Box testing presents different coverage criteria at different times, and there are now dozens of different coverage criteria.
This time from two aspects to introduce some of the more extensive and generally accepted coverage criteria:
First, the control flow test
In the history of software development, it is found that unstructured programs can cause great inconvenience to testing, troubleshooting and maintenance, so people begin to demand that the written procedure is well structured and conforms to the structure. and the control flow graph is very mature to describe the program structure. After that, people put forward several well-known coverage criteria in the control flow according to the coverage criterion.
1. Statement coverage criteria
The statement coverage criterion is one of the simplest methods of testing, and of course, a test method for comparing violence, which requires each statement of the program being tested to be run, while in the control flow graph the nodes corresponding to each statement are overwritten. The coverage of the statement test is expressed as the number of nodes that are overwritten in the control flow Graph [Node (LT)] divided by the number of nodes in the control flow graph (NG).
The expression is the coverage of the statement test = | | NODE (LT) | | /|| NG | |
2. Branch coverage criteria
The statement overrides the most basic test method of the test, so it is powerless for many software errors, so the stronger coverage criterion is raised at this time. Branch testing requires that each branch be given at least one "true" and one "false" in a software test, that is, each branch must have a correct and one-time error test. therefore also called the Branch overlay test contains the statement overlay test. The coverage expression for the branch test is the total number of forward edges in the control flow graph [Edge (LT)] divided by all the forward sides in the control flow graph (EG).
The expression is the coverage of the branch test = | | EDGE (LT) | | /|| eg| |
3. Path coverage criteria
The path coverage criterion is to require that the program's operation be able to overwrite all the full paths in the entire path of the observed program.
The LT side says the full path covered in GP, EP (GP) is the full path in the control flow graph, and its coverage expression is:
Coverage of PATH Coverage tests = | | lt| | /|| EP (GP) | |
Second, data flow test
1. Data Flow Coverage criteria
The simplest way to test a data flow test is to test the correctness of each data definition. It is defined as: if the definition of each variable x in the control flow graph GP with data flow information appears, if the definition appears to be possible to pass to a certain reference of the variable, then it has a path a, which contains a subpath a ', which enables a ' to pass the definition to a certain referential occurrence. It is said that the test data set T satisfies the definition coverage criteria for the test program p.
The above criteria are a few of the high applicability in white box testing.
Software Testing • White-Box testing