Black-Box and White-Box testing techniques
In this article, we explore Black-Box testing and White-Box testing techniques that are useful for correctly approaching software testing in these two modes. First of all, there are two types of test selection criteria.
- Functional test or Black-Box Testing: based on the program specifications and knowledge of the features only and on the search for reliability and efficiency;
- Structural test or White-Box Testing: Based on the program with knowledge of the code, independent of the specifications and with the sole aim of finding defects.
These two criteria are complementary and each can detect malfunctions not detectable with the other.
Below we talk about two techniques for data generation to perform functional checks.
The partition testing (literally, “partitioning of evidence”) is the most characteristic approach of functional testing, the idea is to divide the inputs to be tested into subsets of data, from which the name partitioning is derived.
Each partition must be separated from the others and each value must have a characteristic in common with the other values of the partition. All values must be in the D domain of the program input data. These values could be infinite.
In the testing procedure you can perform the following steps:
- Define the characteristics of the data based on the features to be tested;
- Partitioning by features;
- Combine the values by characteristics creating the input data to be used in the tests, to verify the correct functioning at each data partition.
A fundamental part of this procedure is to define a model of the input data representation more commonly called “Input Domain Model”, (literally “input domain model”, IDM). By identifying the controllable functions and the modules of the application to be tested, all the parameters of the methods and the fields of the modules to be inserted, it is possible to obtain the data to perform the tests. Applying a test criterion for the generation of values, it will be necessary to choose a combination of them, based on the functionalities.
To define IDM, there are two approaches:
- Based on the interface you are testing: the values are generated by identifying the type of each data item. For example, generating a numeric value, a text if it is a string or a date;
- Based on the features: having a complete view of the program’s behavior, values can be generated for specific functions. More difficult to design and develop but with better results than the previous approach.
In choosing the input values, always checking the completeness in the set of case studies and remembering to maintain the disjunction between the individual partitions, we can refer to different strategies:
- Include valid, invalid and special values;
- Include values at the boundaries of domains, values at the limit of the range of possible values. This strategy defines a new selection criterion known as “Boundary value analysis” (literally “boundary of values”);
- Include values that represent a “normal use” of the system;
- Include a considerable number of values with the same characteristics to carry out load tests.
This criterion is based on the principle of analyzing the source code and relying on it to create selection criteria (C) for the tests. Each program can be associated with a control graph. Each node of the graph is a “command” that can be connected to other nodes through arcs. Each node can have input and output arcs. A command can be a simple instruction or a condition. A condition type command can have multiple output arcs, an instruction no. A path includes a set of nodes traversed by a single program execution.
The White-Box Testing is based on the notion of coverage, on the execution of the elements of the graph of the control flow of a program.
The coverage technique (there are different types of coverage: instructions, decisions and conditions) allows to determine the conditions that must be verified by the input data so that a particular path is executed and relates the values produced by the execution of the program with the values in program entry itself. Note that the program is not executed with actual values but with symbolic values derived from the input data. From symbolic values formulas solved based on program execution are processed.