Structural Testing

Structural testing is also called the “white box” testing (also: transparent, open, glass box, based on code). This is a software testing method that assumes that the internal structure / device / system implementation is known to the tester. We select input values based on the knowledge of the code that will process them. Similarly, we know what the result of this treatment should be. Knowledge of all the features of the program under test and its implementation are mandatory for this technique. Testing the white box is a deepening in the internal device of the system, beyond its external interfaces.
According to ISTQB, the “white box” testing is:
– testing, based on the analysis of the internal structure of the component or system.
– test design based on white box technology – the procedure for writing or selecting test cases based on an analysis of the internal device of the system or component.
Structural testing checks the implementation of a program or code by testing the structure of a software system or its components. The tester concentrates on the operation of the software during structural tests. It can be used at all levels of testing.
Why do they call it the “white box” testing? The test program for the tester is like a transparent box, the contents of which he sees very well.
The Main Objectives
The main objectives of structural testing are:
• The apparent inadequacy of identification
• Functional testing
• Understand if there is not enough in our test suite
Methods
Methods of structural testing:
• Statement Coverage verifies that each statement in the program is executed at least once during the testing of the program.
• Path Coverage is designed to meet the criteria for coverage of each logical path through the program.
• Branch Coverage checks to see if each branch condition for the program has true or false values.
• Condition Coverage is similar to Branch Coverage. The main difference is to check the condition of the cover for conditional and non-conditional branches.
Advantages and Disadvantages
Disadvantages of the “white box” testing:
1. The number of independent routes can be very large. For example, if a loop in the program is executed k times, and there are n branches in the loop, then the number of routes is calculated by the formula.
For n = 5 and k = 20, the number of routes is m = 1014. We assume that 1 ms is spent on the development, execution and evaluation of the test on one route. Then at work 24 hours a day 365 days a year for testing will take 3170 years.
2. Exhaustive testing of routes does not guarantee that the program meets the original requirements for it.
3. Some routes may be skipped in the program.
4. You can not detect errors whose appearance depends on the data being processed (these are errors caused by expressions like if abs (a-b) <eps …, if (a + b + c) / 3 = a …).
Advantages of the “white box” testing are due to the fact that the principle of the “white box” allows you to take into account the peculiarities of program errors:
1. The number of errors is minimal in the “center” and maximally on the “periphery” of the program.
2. Preliminary assumptions about the probability of a control flow or data in a program are often incorrect. As a result, a typical route may become a model for which the calculation model is poorly developed.
3. When writing a software algorithm in the form of text in a programming language, it is possible to introduce typical translation errors (syntactic and semantic).
4. Some results in the program depend not on the source data, but on the internal states of the program.
Each of these reasons is an argument for testing on a “white box” basis.
Basis path testing
Basis path testing is a method that is based on the principle of a “white box”. The author of this method is Tom McCabe (1976).
The way to do basis path testing allows you to:
• obtain an assessment of the complex complexity of the program;
• use this estimate to determine the number of test cases required.
Test variants are developed to test the basic set of paths (routes) in the program. They guarantee a single execution of each operator of the program during testing.