White Box Testing Techniques

Volha Hrachova
4 min readMar 18, 2024
White Box Testing Techniques

In the previous article, we discussed that there are different classifications of test design techniques, and one of them is based on the access to code and application architecture, including Black Box and White Box Testing techniques.
We also discussed Black Box Testing techniques in detail.

To fully cover this topic, now let’s talk about White Box Testing techniques.

White Box testing is a strategy in which testing is based on the internal paths, structure, and implementation of the software under test.

Table of Contents:
Control Flow Testing
Data Flow Testing

Control Flow Testing

Let’s start with the definition of what Execution Path is.

Path is a sequence of statement execution that begins at an entry and ends at an exit.

Control Flow Testing identifies the execution paths through a module of program code and then creates and executes test cases to cover those paths.

Definition of Control Flow Testing

Control Flow Testing is a family of testing techniques in which test cases are developed to activate and verify the execution of different event sequences, which are determined through analysis of the application source code.

How to Implement

The whole Control Flow Testing Process includes the following stages:

Control Flow Testing Process Stages

Control Flow Graph Creation
First, create a control flow graph (manually or with the help of software).

Coverage Target
Second, define the coverage target (nodes, edges, paths, branches, etc.)

Test Case Creation
Third, based on the defined coverage target create test cases using control flow graphs.

Test Case Execution
After that execute created test cases.

Analysis of Result
In the end, analyze the results to verify the quality.

Objectives of Control Flow Testing

Path Coverage
verify that every path through the program is run at least once.

Branch Coverage
verify that every decision point (branch) in the program is evaluated as true or false at least once.

Decision Coverage
verify that each decision point in the program is executed to cover all potential outcomes at least once.

Loop Testing
verify how the program performs in various loop scenarios (numerous, zero, and single iterations).

Error-Handling Paths
verify how the program handles error and exception paths.

Multiple Condition Testing
verify simple and complicated condition combinations inside the decision points.

Boundary Value Testing
verify how software behaves when input ranges are close to boundaries.

Integration Testing
verify how various software modules interact with each other.

To sum up, control flow graphs are the foundation of control flow testing. Modules of code are converted to graphs, the paths through the graphs are analyzed, and test cases are created from that analysis.

Control Flow Testing technique is mostly used in Unit Testing.

Data Flow Testing

Issues related to data flow remain a significant concern for developers and organizations. Examples of such issues are:
- a variable is declared but never used
- a variable is used but never declared
- a variable is defined multiple times before it is used
- a variable is released from memory before it has been fully utilized
These cases of mishandled data lead to bugs and unexpected behavior.

Data Flow Testing is White Box testing technique that helps discover hidden problems and weaknesses in how data moves through software programs.

Definition of Data Flow Testing

Data Flow Testing is a family of testing techniques based on selecting individual paths from the control flow in order to investigate events associated with changes in the state of variables.

There are 2 types of Data Flow Testing:
1) Static Data Flow Testing and
2) Dynamic Data Flow Testing

Static Data Flow Testing

In Static Data Flow Testing declaration, usage, and deletion of the variables are examined without executing the code.

It constructs a control flow graph, which represents various execution paths through the code. This graph is then analyzed to identify potential data flow anomalies, such as uninitialized variables, undeclared variables, and variable redefinitions before they pop up as runtime errors.

The primary goal of Static Data Flow Testing is to discover issues at the earliest stages of development before a program is even executed.

Dynamic Data Flow Testing

In Dynamic Data Flow Testing variables and data flow are examined with the execution of the code.

Dynamic Data Flow Testing validates how the program behaves under real-world conditions. It helps identify issues that may only occur during runtime, such as logic errors, incorrect data transformations, and runtime exceptions.

This testing technique is useful to ensure that the program functions as intended and handles data correctly during its execution.

Conclusions

As you could see, there are various White Box Testing techniques. They require programming knowledge and therefore are mostly used by developers. But they significantly help to improve product quality, which should be a great motivation for testers to dive into programming as well.

Sources

A Practitioner’s Guide to Software Test Design by Lee Copeland
Foundations of Software Testing: ISTQB Certification by Dorothy Graham
Software Testing. Base Course​ by Svyatoslav Kulikov

--

--

Volha Hrachova

Lead Software Test Engineer and Software Quality Enthusiast