---
title: "White Box Testing: Techniques, Coverage, and Examples"
description: White box testing is a testing method where testers evaluate the quality of a system with full knowledge of its internal structures.
image: https://cms-cdn.katalon.com/Insight_7_48e441de95.png
---

Up to 55% off Your first purchase - Offer ends Oct 31 [Claim offer](https://mkt.qa.katalon.com/pricing?campaign_source=top-nav-banner&campaign_medium=banner&campaign_name=oct-2026)

[Contact us](https://mkt.qa.katalon.com/contact-us?contact_source=top-nav) [Log in](https://mkt.qa.katalon.com/sign-in?ref=header_start_free_trial&return_to=%2Fresources-center%2Fblog%2Fwhat-is-white-box-testing)

[![Katalon](https://mkt.qa.katalon.com/hubfs/website-assets-2026/brand/katalon-wordmark.svg)](https://mkt.qa.katalon.com/)

 True Platform

 Solutions 

[Pricing](https://mkt.qa.katalon.com/pricing)

 Resources

[Start free trial](https://mkt.qa.katalon.com/open-true-platform?ref=header_start_free_trial) [Book a demo](https://mkt.qa.katalon.com/view-a-demo?contact_source=top-nav)

[Test automation Katalon Studio Author web, mobile, API and desktop tests with no-code, low-code or full code.](https://mkt.qa.katalon.com/katalon-studio) [Test management + manual testing TestOps Plan cycles, track coverage and gate releases on one shared report.](https://mkt.qa.katalon.com/testops) [Test execution TestCloud Run suites in parallel on real browsers, devices and your own CI runners.](https://mkt.qa.katalon.com/testcloud) [Production insights TrueTest See how real users move through your product and where coverage is missing.](https://mkt.qa.katalon.com/truetest)

![](https://mkt.qa.katalon.com/hubfs/website-assets-2026/brand/katalon-ai.svg)

Katalon AI runs through all four

 Generate cases from requirements, heal locators when the app changes, and summarise release readiness.

[Explore Katalon AI](https://mkt.qa.katalon.com/ai-powered-testing-platform) [Katalon MCP server](https://mkt.qa.katalon.com/katalon-mcp)

Application under test

[Web testing Quickly create your tests, debug with advanced tools, and execute across multiple browsers.](https://mkt.qa.katalon.com/web-testing) [API testing Streamline testing for any API architecture, and unify API, web and mobile testing in one platform.](https://mkt.qa.katalon.com/api-testing) [Mobile testing Test your Android and iOS apps across browsers, devices and operating systems.](https://mkt.qa.katalon.com/mobile-testing) [Desktop testing Test your Windows apps with Studio and move between AUTs without leaving the tool.](https://mkt.qa.katalon.com/desktop-testing)

Enterprise-grade testing

 Deliver quality at any scale: Studio's ease of use, a central testing command centre, AI-assisted authoring and enterprise security controls. 

[See enterprise capabilities](https://mkt.qa.katalon.com/enterprise)

By industry

[Banking and financial services](https://mkt.qa.katalon.com/banking-financial-services-software-testing) [Retail and ecommerce](https://mkt.qa.katalon.com/retail-ecommerce-software-testing) [Tech, telco and SaaS](https://mkt.qa.katalon.com/tech-telco-saas-software-testing) [Healthcare](https://mkt.qa.katalon.com/healthcare-software-testing) [Insurance](https://mkt.qa.katalon.com/insurance-software-testing) [Government and public sector](https://mkt.qa.katalon.com/government-and-public-sector-software-testing)

Learn

[Product docs Guides, feature specs, and API reference for every product.](https://docs.katalon.com) [Katalon Academy Over 50 free courses, with certifications on Katalon tools.](https://academy.katalon.com) [Release notes What shipped, product by product.](https://docs.katalon.com/katalon-platform/release-notes/katalon-testops-release-notes)

Get help

[Katalon community Advice, tips, and working examples from thousands of testing pros.](https://mkt.qa.katalon.com/community-hub) [Technical support Raise a ticket with the team and track it through to a fix.](https://support.katalon.com) [Trust center Security, privacy, and compliance documentation.](https://trust.katalon.com/)

Insights

[Blog](https://mkt.qa.katalon.com/resources-center/blog) [Webinars and events](https://mkt.qa.katalon.com/webinars) [Reports](https://mkt.qa.katalon.com/reports) [Success stories](https://mkt.qa.katalon.com/case-studies) [![](https://katalon.com/images/the-future-of-software-testing/tfost-icon.png?width=32&height=32&name=tfost-icon.png) The Future of Software Testing](https://thefutureofsoftwaretesting.com)

[![](https://katalon.com/images/qa-leaders-live/qa-leaders-webinar-banner.png?width=1916&height=1156&name=qa-leaders-webinar-banner.png) Upcoming webinar QA Leaders Live: Navigating the Future of Software Quality October 27, 2026 Four live episodes on AI, automation, and delivering quality at scale. Register now](https://mkt.qa.katalon.com/webinars/qa-leaders-live)

[Download Studio](https://mkt.qa.katalon.com/download) [Browse integrations](https://mkt.qa.katalon.com/integrations) [Talk to an expert](https://mkt.qa.katalon.com/contact-us)

[![Katalon](https://mkt.qa.katalon.com/hubfs/website-assets-2026/brand/katalon-wordmark.svg)](https://mkt.qa.katalon.com/)

 True Platform

[Katalon Studio](https://mkt.qa.katalon.com/katalon-studio) [TestOps](https://mkt.qa.katalon.com/testops) [TestCloud](https://mkt.qa.katalon.com/testcloud) [TrueTest](https://mkt.qa.katalon.com/truetest)

 Katalon AI

[Explore Katalon AI](https://mkt.qa.katalon.com/ai-powered-testing-platform) [Katalon MCP](https://mkt.qa.katalon.com/katalon-mcp)

 Solutions

Application under test

[Web testing](https://mkt.qa.katalon.com/web-testing) [API testing](https://mkt.qa.katalon.com/api-testing) [Mobile testing](https://mkt.qa.katalon.com/mobile-testing) [Desktop testing](https://mkt.qa.katalon.com/desktop-testing)

By industry

[Banking and financial services](https://mkt.qa.katalon.com/banking-financial-services-software-testing) [Retail and ecommerce](https://mkt.qa.katalon.com/retail-ecommerce-software-testing) [Tech, telco and SaaS](https://mkt.qa.katalon.com/tech-telco-saas-software-testing) [Healthcare](https://mkt.qa.katalon.com/healthcare-software-testing) [Insurance](https://mkt.qa.katalon.com/insurance-software-testing) [Government and public sector](https://mkt.qa.katalon.com/government-and-public-sector-software-testing)

Enterprise-grade testing

[See enterprise capabilities](https://mkt.qa.katalon.com/enterprise)

[Pricing](https://mkt.qa.katalon.com/pricing)

 Resources

Learn

[Product docs](https://docs.katalon.com) [Katalon Academy](https://academy.katalon.com) [Release notes](https://docs.katalon.com/katalon-platform/release-notes/katalon-testops-release-notes)

Get help

[Katalon community](https://mkt.qa.katalon.com/community-hub) [Technical support](https://support.katalon.com) [Trust center](https://trust.katalon.com/)

Insights

[Blog](https://mkt.qa.katalon.com/resources-center/blog) [Webinars and events](https://mkt.qa.katalon.com/webinars) [Reports](https://mkt.qa.katalon.com/reports) [Success stories](https://mkt.qa.katalon.com/case-studies) [The Future of Software Testing](https://thefutureofsoftwaretesting.com)

Get started

[Download Studio](https://mkt.qa.katalon.com/download) [Browse integrations](https://mkt.qa.katalon.com/integrations) [Talk to an expert](https://mkt.qa.katalon.com/contact-us)

[Start free trial](https://mkt.qa.katalon.com/open-true-platform?ref=header_start_free_trial) [Book a demo](https://mkt.qa.katalon.com/view-a-demo?contact_source=top-nav)

[Contact us](https://mkt.qa.katalon.com/contact-us?contact_source=top-nav) [Log in](https://mkt.qa.katalon.com/sign-in?ref=header_start_free_trial&return_to=%2Fresources-center%2Fblog%2Fwhat-is-white-box-testing)

 All All News Products Insights Community

- [All](https://mkt.qa.katalon.com/resources-center/blog)
- [News](https://mkt.qa.katalon.com/resources-center/blog/tag/news)
- [Products](https://mkt.qa.katalon.com/resources-center/blog/tag/products)
- [Insights](https://mkt.qa.katalon.com/resources-center/blog/tag/insights)
- [Community](https://mkt.qa.katalon.com/resources-center/blog/tag/community)

 Search

Click

![search icon](https://d1h3p5fzmizjvp.cloudfront.net/themes/katalon_4/images/pages/search_page/search_lilac_icon.svg)

# What Is White Box Testing? Techniques, Examples & Best Practices

White box testing is a testing method where testers evaluate the quality of a system with full knowledge of its internal structures.

[Start free trial](https://mkt.qa.katalon.com/sign-up?ref=blog_insight_hero_banner_download_studio_hero) [Book a demo](https://mkt.qa.katalon.com/view-a-demo#see-katalon-action)

General QA

Unit Testing

![Hero Banner](https://cms-cdn.katalon.com/Insight_7_48e441de95.png)

[![logo](https://mkt.qa.katalon.com/hubfs/katalon_logo%20(1).svg)](https://mkt.qa.katalon.com/)

[All](https://mkt.qa.katalon.com/resources-center/blog) [News](https://mkt.qa.katalon.com/resources-center/blog/tag/news) [Products](https://mkt.qa.katalon.com/resources-center/blog/tag/products) [Insights](https://mkt.qa.katalon.com/resources-center/blog/tag/insights) [AI](https://mkt.qa.katalon.com/resources-center/blog/tag/ai) [DevOps and CI/CD](https://mkt.qa.katalon.com/resources-center/blog/tag/devops-and-ci-cd) [Community](https://mkt.qa.katalon.com/resources-center/blog/tag/community)

[View Demo](https://mkt.qa.katalon.com/view-a-demo) [Download Studio](https://mkt.qa.katalon.com/download)

Smart Summary

White box testing is an indispensable software quality assurance practice, enabling testers to rigorously evaluate system quality by possessing complete knowledge of its internal structures, logic, and code. This developer-centric approach ensures thorough verification of operations, proactive identification of vulnerabilities, and comprehensive code coverage across all testing stages.

- **Implement White Box Testing Strategically:** Employ white box testing at the unit level to catch errors early, during integration to validate component interactions, and for regression testing to confirm updates haven't introduced new defects, ensuring continuous code integrity.
- **Utilize Advanced White Box Testing Techniques:** Apply Control Flow Testing to execute predefined code paths and Structured Testing (Basic Path Testing) to cover all independent execution paths. Compute Cyclomatic Complexity (C = Edges - Nodes + 2) to quantify program intricacy and guide test case design.
- **Navigate White Box Testing's Strengths and Limitations:** Benefit from white box testing's code-centric granularity and automation potential for optimization, but be mindful of the extensive paths in complex systems, the inability to detect missing paths, and the high technical skill requirement for testers.

Good response

Bad response

|

Copied

 \>

Read more

[Blog](https://mkt.qa.katalon.com/resources-center/blog) / [Insights](https://mkt.qa.katalon.com/resources-center/blog/tag/insights) /

What Is White Box Testing? Techniques, Examples & Best Practices

## What Is White Box Testing? Techniques, Examples & Best Practices

![Henrik (Minh Huy) Dao](https://mkt.qa.katalon.com/hubfs/Henrik%20(Minh%20Huy%20Dao).jpg)

[Henrik (Minh Huy) Dao](https://mkt.qa.katalon.com/author?name=henrik-minh-huy-dao)

Senior Quality Engineer Updated on

Learn with AI

Linkedin

Facebook

X (Twitter)

Mail

Learn with AI

![](https://d1h3p5fzmizjvp.cloudfront.net/themes/katalon_4/images/pages/glossary_page/blog_glossary_icon.svg)

White Box Testing

A testing method that examines the internal structure, logic, and code of an application to ensure accuracy, security, and optimal performance.

White box testing is a testing method where testers evaluate the quality of a system with full knowledge of its internal structures. Here, the testers have access to the system's source code and understand how it operates internally. They know not only what the software does but also how it achieves those results.

In this article, we’ll learn more about white box testing in-depth, the common techniques used, and white box testing best practices.

## **What is White Box Testing?**

![black box testing vs white box testing vs grey box testing](https://cms-cdn.katalon.com/black_box_testing_vs_white_box_testing_vs_grey_box_testing_95e3f33baf.png)

White box testing is a crucial testing technique because it examines the system from the developer's perspective. It requires testers to look inside the software's "white box" to understand its inner workings.  
 

Testers can then verify that all internal operations function as expected and identify any security vulnerabilities, logic errors, or gaps in code coverage. This method ensures that the system performs not only its intended functions but does so efficiently and securely.

## **White Box Testing vs Black Box Testing vs Grey Box Testing**

White box testing is the opposite of black box testing. With black box testing, testers do not need to know the internal working of the system. With white box testing, testers need to understand the internal workings. This is the **opacity** of the system.

 

> **Read More:** [What is Black Box Testing? Definition, Techniques, Best Practices](https://katalon.com/resources-center/blog/black-box-testing)

Here's a quick comparison of the 3 approaches:

 

| **Feature** | **Black Box Testing** | **White Box Testing** | **Grey Box Testing** |
| --- | --- | --- | --- |
| **Definition** | Testing without knowing the internal code structure. Focuses on input-output and functionality. | Testing with full knowledge of the internal code structure. Focuses on code logic and coverage. | Testing with partial knowledge of the internal code structure. Combines elements of both black and white box testing. |
| **Testers' Knowledge** | No knowledge of the internal workings of the software. | Complete knowledge of the internal workings of the software. | Partial knowledge of the internal workings of the software. |
| **Focus** | Functionality, user interface, and user experience. | Code logic, paths, branches, and internal structures. | Both functionality and internal structures, with a focus on integration and interactions. |
| **Advantages** | - Identifies missing functionalities.  \- User-oriented. \- No need for programming knowledge. | - Detailed and thorough testing. \- High code coverage. \- Optimizes code. | - Balanced approach.  \- More effective in finding defects in integrated systems. \- Better coverage than black box testing alone. |
| **Disadvantages** | - Limited coverage of code paths.  \- Can miss logical errors in the code. | - Time-consuming.  \- Requires programming skills.  \- May not reflect user perspective. | - Requires both functional and code knowledge.  \- Can be complex to design.  \- May not be as thorough as pure white box testing. |
| **Typical Testers** | Testers, QA engineers, end-users. | Developers, QA engineers with programming skills. | Testers with some programming knowledge, developers. |
| **Testing Techniques** | Equivalence partitioning, boundary value analysis, decision table testing. | Statement coverage, branch coverage, path coverage, condition coverage. | Matrix testing, regression testing, pattern testing, orthogonal array testing. |
| **Tools Used** | Selenium, QTP, LoadRunner, TestComplete. | JUnit, NUnit, CUnit, Emma, Clover, SonarQube. | Selenium, QTP, Rational Functional Tester, integration tools. |
| **Use Cases** | Acceptance testing, system testing, functional testing. | Unit testing, integration testing, security testing, code optimization. | Integration testing, penetration testing, system testing. |

Note: The traditional distinction between white-box and black-box testing is becoming less important. In modern testing, tests are derived from many different sources, not just the code or requirements. Testers now use abstract structures like:

- Input spaces (possible inputs to the system)
- Graphs (representing workflows or data flows)
- Logical rules (to check how the system should behave)

These structures can come from source code, requirements, design models, or other documents. The key focus now is what level of abstraction the tests are designed from, not whether they are "white-box" or "black-box."

Therefore, the white-box vs. black-box distinction is **less relevant** in modern software testing practices.

## **Levels of White Box Testing**

### **1. [Unit Testing](https://mkt.qa.katalon.com/resources-center/blog/unit-testing)**

This is the first level of testing, where individual pieces of code (called units) are tested by themselves to make sure they work correctly before being combined with other parts of the program. White-box testing at this stage helps catch mistakes early, which can prevent bigger problems later when the code is integrated into the rest of the system.

### **2. [Integration Testing](https://mkt.qa.katalon.com/resources-center/blog/integration-testing)**

Once individual units are tested, they are combined to see if they work together as expected. White-box testing at this stage checks how different parts of the program interact with each other. It ensures that the connections between different components work correctly, based on what the programmer knows about how they should behave.

### **3. [Regression Testing](https://mkt.qa.katalon.com/resources-center/blog/regression-testing)**

After updates or changes are made to the program, it’s important to make sure that nothing else broke as a result. White-box testing during regression testing reuses the same tests from unit and integration testing to ensure that the program still works as expected after changes are made.

## **White Box Testing Process**

The general white box testing process includes 7 steps:

1. **Analyze the SUT**: Testers examine the software’s source code, architecture, and internal workings, collaborating with the dev or product teams for more insights.
2. **Identify Paths**: They map out all possible data paths through the system, focusing on branches, loops, and conditions that affect execution flow.
3. **Path Sensitization**: Testers select inputs that trigger each identified path to ensure every route is tested at least once.
4. **Determine Expected Results**: For each input, testers predict the expected outcomes based on the code.
5. **Execute Tests**: They run the selected inputs through the system to observe how the software behaves internally.
6. **Compare Outputs**: The actual output is compared to the expected results to spot any discrepancies.
7. **Assess Functionality**: Based on the comparison, testers decide whether the software is working correctly.

## **Advantages of White Box Testing**

The key benefits of white box testing include:

- **Code-centric:** white-box testing allows for a thorough examination of internal structures, logic, and code paths, giving testers a much deeper understanding of the system as compared to black box testing where they merely “scratch the surface”.
- **Granularity:** since testers now have complete knowledge of the system, they can tailor the test cases specifically to the internal logic. This leads to higher code coverage, including edge cases.
- **Optimization:** going beyond just “finding the bug”, testers can now join the optimization process where they give recommendations to eliminate redundant code.
- **Automation:** white-box testing opens up opportunities for automation testing, saving a lot of time and resources.

## **Disadvantages of White Box Testing**

- **Large number of execution paths:** for more complex systems, the number of execution paths can be astronomically huge. Attempting to test all of those paths takes up a lot of time and resources.
- **Control flow assumption:** as testers go into white box testing, they generally assume that the control flow is already correctly designed. They don’t want to focus on validating these flows, but bugs can totally arise from that.
- **Non-existent paths:** since white box testing focuses on the paths that are present in the code, it cannot identify paths that are missing altogether. For example, if there is a logical condition that is never checked or a scenario that is never handled in the code, white box testing won't reveal this absence because it only tests what is already there.
- **Technical skills:** testers must have adequate knowledge and technical expertise to do white box testing properly.

[![banner5.png](https://cms-cdn.katalon.com/banner5_1bff611ab3.png)](https://katalon.com/katalon-studio)

## **White Box Testing Techniques**

### **1. Control Flow Testing**

Control flow testing is a white-box testing technique that focuses on creating and executing test cases to cover pre-identified execution paths through the program code.

While indeed control flow testing grants testers a high degree of thoroughness, it has some drawbacks:

1. The number of paths can reach huge figures. Modern applications are usually complex enough to render an attempt at exhaustive testing of all control flow paths quite impossible.
2. White box testing only works with implemented paths. If a path is missing, it will never be found. For example, here we want to calculate the grade based on the score. The code here misses the path for scores below 60.

Python

 Copy

```
def calculate_grade(score):
    if score >= 90:
        grade = 'A'
    elif score >= 80:
        grade = 'B'
    elif score >= 70:
        grade = 'C'
    elif score >= 60:
        grade = 'D'
    else:
        grade = 'F'
    return grade
```

 

There can also be errors within the code despite the correct flow. For example, here we want to calculate the inventory when an order is successfully dispatched. The flow is correct, but current\_inventory is supposed to decrease (- 1) instead of (+ 1).

Python

 Copy

```
def calculate_inventory(order_dispatched, current_inventory):
    if order_dispatched:
        return current_inventory + 1
```

To do control flow testing, you also need to understand the Control Flow Graph. A Control Flow Graph (CFG) is a graphical representation of all the paths that might be traversed through a program during its execution. It is used extensively in control flow testing to analyze and understand the program’s structure.

A control flow graph has 3 major components:

1\. Node: these are individual statements or blocks of code. For example, in the code snippet below we have 3 nodes:

Python

 Copy

```
int a = 0;  // Node 1
if (b > 0) { // Node 2
  a = b;    // Node 3
}
```

2\. Edge: this is the flow of control from one node to another. It indicates the execution flow of the program. There are 2 types of edges:

- **Unconditional edge**: direct flow from one statement to another without any condition
- **Conditional edge**: these are branches based on a condition (e.g. True/False outcomes of an if-statement)

Here we have a conditional edge from statement ‘if (b \> 0)’ to statement ‘a=b’.

> int a = 0;
> 
> if (b \> 0) {
> 
>   a = b;
> 
> }

**3. Entry/Exit Points:** these represent the start and end of a program in the CFG.

Let’s look at another example:

Python

 Copy

```
void exampleFunction(int x, int y) {
    if (x > 0) {
        if (y > 0) {
            printf("Both x and y are positive.\n");
        } else {
            printf("x is positive, y is non-positive.\n");
        }
    } else {
        printf("x is non-positive.\n");
    }
}
```

Here we have:

- 7 nodes (1 entry point, 1 exit point, 5 decisions) 
    - 1: Entry point of exampleFunction.
    - 2: if (x \> 0).
    - 3: if (y \> 0).
    - 4: printf("Both x and y are positive.\\n");.
    - 5: printf("x is positive, y is non-positive.\\n");.
    - 6: printf("x is non-positive.\\n");.
    - 7: Exit point of exampleFunction.
- Edges: 
    - (1 -\> 2)
    - (2 -\> 3) if x \> 0
    - (2 -\> 6) if x \<= 0
    - (3 -\> 4) if y \> 0
    - (3 -\> 5) if y \<= 0
    - (4 -\> 7)
    - (5 -\> 7)
    - (6 -\> 7)

There are 3 execution paths in total for this CFG to cover all 3 possible outcomes. Here’s the CFG for the code:![Control Flow Graph](https://cms-cdn.katalon.com/control_flow_graph_170e57422c.png)

Here's how you can find out all the necessary paths for Control Flow testing:

1. Identify where the module begins executing **(entry point)** and where it completes its execution or returns control **(exit point)**.
2. Start by tracing **the leftmost path** through the module from the entry point to the exit point. This path follows the sequence of statements and branches as defined in the code.
3. Once you've traced the leftmost path, return to the entry point and **vary the first branching condition**. This means taking the alternative path(s) that were not taken in the leftmost path due to branching conditions (e.g., if-else statements, switch-case statements).
4. Repeat this process for each subsequent branching condition in the module. For example, after varying the first branching condition, vary the second branching condition, then the third, and so on, until all possible control flow paths (or significant paths) through the module are covered.
5. List down each distinct path taken through the module, including combinations of different branching conditions.

 

Of course, in practice, **100% coverage** can be difficult to achieve. There can be code that is only executed in *exceptional circumstances*. Such type of code can often be found in try-catch blocks or conditional statements checking for edge cases. Here are some examples:

1. A disk read/write operation fails due to a bad sector on a hard drive.
2. Intermittent network connectivity or complete loss of network connection during a critical transaction.
3. Deadlocks or race conditions in multi-threaded applications.
4. Gradual memory leak leading to out-of-memory conditions after extended usage.

There are 8 levels (Level 0 - Level 7) of coverage in White box testing. Here is a quick table of comparison:

 

| **Level** | **Coverage Level** | **Description** | **Advantages** | **Disadvantages** |
| --- | --- | --- | --- | --- |
| **0** | **Statement Coverage** | Ensures each statement is executed | Simple to measure, basic confidence | May miss logical paths |
| **1** | **Branch Coverage** | Ensures each branch is executed | Tests decision points | May miss condition combinations |
| **2** | **Condition Coverage** | Ensures each condition is tested | Tests each part of conditions | May miss some combinations of conditions |
| **3** | **Multiple Condition Coverage** | Ensures all condition combinations are tested | Most thorough condition testing | Complex and time-consuming |
| **4** | **Path Coverage** | Ensures all control flow paths are executed | High confidence in code correctness | Infeasible for complex code |
| **5** | **Function Coverage** | Ensures each function is called | Simple to measure, ensures functions are invoked | Does not test internal function paths |
| **6** | **Loop Coverage** | Ensures loops are executed with different iteration counts | Targets loop-related errors | May not be comprehensive for very complex loops |
| **7** | **Data Flow Coverage** | Ensures all variable definitions and uses are tested | Focuses on variable lifecycle, catches data-related errors | Complex to track in large codebases |

### **2. Structured Testing (Basic Path Testing)**

Structured testing or basic path testing is a white box testing technique aimed to identify and test all independent paths within the software. The goal is to ensure that all possible execution paths in a program are tested at least once.

 

A typical structured testing process happens in the following steps:

1. Derive the control flow graph from the software module.
2. Compute the graph's Cyclomatic Complexity (C).
3. Select a set of C basis paths.
4. Create a test case for each basis path.
5. Execute these tests.

**Cyclomatic Complexity** is a software metric used to measure the complexity of a program's control flow. It was developed by Thomas J. McCabe, Sr. in 1976 and is a key indicator of the number of linearly independent paths through a program's source code. Here’s the formula:

> C = Edges - Nodes + 2

Let’s look at this example once more. There are 8 edges (8 arrows) and 7 nodes. We have a Cyclomatic Complexity of 8 - 7 + 2 = 3. This means there are **3 linearly independent paths** through the program.

![Control Flow Graph](https://cms-cdn.katalon.com/control_flow_graph_170e57422c.png)  
 

**Interpretation of Cyclomatic Complexity:**

- C = 1-10: Simple program, low risk, straightforward to test and maintain.
- C = 11-20: Moderate complexity, requires more careful testing and review.
- C = 21-50: High complexity, increased risk of errors, needs thorough testing and documentation.
- C \> 50: Very high complexity, high risk, challenging to test and maintain, likely needs refactoring.

We can now identify the independent paths through the system:

- Path 1: If x \> 0 → if y \> 0 → Both x and y are positive
- Path 2: If x \> 0 → if y \< 0 → x is positive, y is non-positive
- Path 3: If x \< 0 → x is non-positive

From this, we can start designing the test cases:  
 

**Test case 1:**

- **Inputs:** x = 5, y = 2
- **Expected Output:** Both x and y are positive

**Test case 2:**

- **Inputs:** x = 5, y = -2
- **Expected Output:** x is positive, y is non-positive

**Test case 3:**

- **Inputs:** x = -2
- **Expected Output:** x is non-positive

Control flow testing is particularly effective in finding logical errors and ensuring all conditions are tested. However, testers need to understand the code to identify paths and create appropriate test cases. Generating and executing test cases for all paths can also be labor-intensive, especially in complex systems with numerous control flow branches.

### **3. Data Flow Testing**

![White Box Testing Techniques: Data Flow Testing](https://cms-cdn.katalon.com/white_box_testing_techniques_data_flow_testing_6568ee13f4.png)

Data Flow Testing is a technique used by testers to track how information moves through a program and make sure it is handled correctly. Think of it as following the life of a package:

- **First**, the package is created **(Definition)**.
- **Next**, it’s used for something, like being opened **(Use)**.
- **Finally**, the package is thrown away **(Kill)**.

Here are a few common mistakes (called *data flow anomalies*) that testers look for:

1. **Using Data Before It's Ready**  
   Imagine opening a package that hasn’t arrived yet. This would be like trying to use data that hasn’t been created or given a value. It causes confusion and can crash a program.
2. **Using the Same Data Without Updating It**  
   Think of writing a letter, sending it, and then sending the exact same letter again without updating any information. If you’re expecting a different result, this is a mistake.
3. **Using Data That Was Only Created Under Certain Conditions**  
   Picture a flashlight that only works if the batteries are inside. If you assume the flashlight will work without checking the batteries, you’ll be disappointed. Similarly, if a variable is only created under specific conditions but is later used as if it always exists, that’s a problem.

These mistakes can cause bugs, crashes, or unexpected behavior in programs. Data Flow Testing helps catch these errors before they become serious issues.

 

There are 3 stages of a variable:

1. **Definition (d)**: Variables are defined when they are declared or first assigned a value.
2. **Use (u)**: Variables are used in computations or conditionals.
3. **Kill (k)**: Variables are destroyed when they go out of scope or when the program ends.

These annotations can be used to construct data flow graphs that visually represent how variables are manipulated throughout the program's execution paths.

There are 2 approaches to Data flow testing:  
 

#### **1. Static data flow testing**

Static data flow testing is a method used in software testing to analyze the flow of data through a program's source code without executing it. We will create these diagrams and check that the define-use-kill patterns are correct. After that, we do a static analysis, which means examining the diagram either formally through inspections or informally by reviewing it. Next, we will perform dynamic tests on the module by creating and running test cases.

Here are the data flow anomalies to consider:

1. **dd (Defined and Defined again)**: Redefining a variable without using it in between.
2. **du (Defined and Used)**: Proper and expected usage where a variable is defined before its use.
3. **dk (Defined and Killed)**: Defining a variable but never using it.
4. **ud (Used and Defined)**: Using a variable and then redefining it, potentially for resetting its value.
5. **uu (Used and Used again)**: Multiple uses of a variable without redefinition.
6. **uk (Used and Killed)**: Using a variable and then destroying it, indicating proper cleanup.
7. **kd (Killed and Defined)**: Destroying a variable and then redefining it, possibly for re-initialization.
8. **ku (Killed and Used)**: Using a variable after it has been destroyed, which is usually an error.
9. **kk (Killed and Killed again)**: Redundant destruction of a variable, indicating potential logic flaws.

#### **2. Dynamic data flow testing**

Dynamic data flow testing is a white-box testing method that checks how data moves and changes while the program runs. It tracks data as it flows through different parts of the program, helping to find errors that happen during execution, like when variables aren't properly set or when data is handled incorrectly. This type of testing is crucial for making sure that the program handles data correctly under different conditions and that it works as expected in real-world use.

Here's a quick comparison of the 2 approaches:

| **Aspect** | **Dynamic Data Flow Testing** | **Static Data Flow Testing** |
| --- | --- | --- |
| **Focus** | Actual data values and transformations during runtime. | Potential data paths and dependencies without execution. |
| **Techniques** | Execution tracing, input generation, dynamic analysis tools. | Static code analysis, control flow analysis, data flow analysis. |
| **Objectives** | Validate data handling logic, detect runtime errors. | Identify issues like uninitialized variables, data misuse. |
| **Benefits** | Insights into actual program behavior, early error detection. | Early issue detection, code quality improvement. |
| **Challenges** | Execution overhead, non-deterministic behaviors. | Limited dynamic behavior coverage, potential false positives. |
| **Suitability** | Best for detecting runtime errors, dynamic behavior analysis. | Best for early-stage code quality checks, static dependency analysis. |

[![banner7.png](https://cms-cdn.katalon.com/banner7_43edeeaa38.png)](https://katalon.com)

Explain

|

## FAQs on White Box Testing

### What is white box testing?

\+

A testing method that examines the internal structure, logic, and code of an application. Testers access source code and validate not only what the software does, but how results are produced—checking internal operations, logic, security, and code coverage.

### What makes white box testing different from black box and grey box testing?

\+

- **Black box**: no knowledge of internal code; focuses on inputs/outputs and functionality.
- **White box**: full knowledge of internal code; focuses on code logic, paths/branches, and coverage.
- **Grey box**: partial internal knowledge; combines elements of both, often emphasizing integration and interactions.

### At what levels is white box testing applied?

\+

- **Unit testing**: verifies individual code units in isolation to catch mistakes early.
- **Integration testing**: checks how tested units interact when combined.
- **Regression testing**: reuses unit/integration tests after changes to confirm no new defects were introduced.

### What is the standard white box testing process described?

\+

Analyze the system under test (SUT) → identify execution paths → select inputs to trigger paths (path sensitization) → determine expected results from code → execute tests → compare actual vs expected outputs → assess whether functionality behaves correctly.

### What are the main advantages of white box testing?

\+

Deeper, code-centric validation than surface-level functional checks; higher granularity and potential code coverage (including edge cases); supports optimization by identifying redundant code; creates strong opportunities for automation.

### What are the main disadvantages and limitations called out?

\+

Explosion of execution paths in complex systems; assumptions about correct control flow can hide defects; cannot detect *missing* paths (only tests implemented paths); requires strong technical/programming skills.

### What are the key techniques covered, and when are they used?

\+

- **Control Flow Testing**: designs tests to cover predefined execution paths using a Control Flow Graph (CFG) with nodes, edges (conditional/unconditional), and entry/exit points; includes multiple coverage levels (statement → data flow).
- **Structured / Basic Path Testing**: derives CFG → computes cyclomatic complexity **C = Edges − Nodes + 2** → selects **C** basis paths → creates a test per path.
- **Data Flow Testing**: tracks variable lifecycle (**define, use, kill**) to find anomalies; can be **static** (no execution, diagram/code analysis) or **dynamic** (runtime tracking of data movement and transformations).

 

![Henrik (Minh Huy) Dao](https://mkt.qa.katalon.com/hubfs/Henrik%20(Minh%20Huy%20Dao).jpg)

[Henrik (Minh Huy) Dao](https://mkt.qa.katalon.com/author?name=henrik-minh-huy-dao)

Senior Quality Engineer

Minh Huy Dao (Henrik) is a Senior Quality Engineer at Katalon, where he has worked since 2023. He has nearly 10 years of experience in QA and test automation, including roles at TMA Solutions, Axon Active and Doctor Anywhere. His work spans automation with Java, JavaScript and WebdriverIO, as well as CI/CD with Jenkins and leading Scrum teams.

<https://www.linkedin.com/in/minh-huy-dao-38a6011b6/>

on this page

Generate your first test case before you finish this article.

Test management and execution. Manual or Automated. One platform, no syncing results between tools.

Free 30-day trial [Start free trial](https://katalon.com/open-true-platform?ref=blog_sticky_cta)

![katalon\_black\_logo](https://mkt.qa.katalon.com/hubfs/katalon_black_logo.svg)

True Platform

[Test Automation with Katalon Studio](https://mkt.qa.katalon.com/katalon-studio) [Test Management](https://mkt.qa.katalon.com/testops) [Test Execution Cloud](https://mkt.qa.katalon.com/testcloud) [Production Insights](https://mkt.qa.katalon.com/truetest) [True Information Center](https://mkt.qa.katalon.com/true-information-center)

Solutions

[Katalon AI](https://mkt.qa.katalon.com/ai-powered-testing-platform) [Katalon MCP](https://mkt.qa.katalon.com/katalon-mcp) [Web Testing](https://mkt.qa.katalon.com/web-testing) [Mobile Testing](https://mkt.qa.katalon.com/mobile-testing) [API Testing](https://mkt.qa.katalon.com/api-testing) [Desktop Testing](https://mkt.qa.katalon.com/desktop-testing) [Visual Testing](https://mkt.qa.katalon.com/visual-testing) [Integrations](https://mkt.qa.katalon.com/integrations)

Resources

[Virtual Labs](https://cec.katalon.com) [Blog](https://mkt.qa.katalon.com/resources-center/blog) [Webinars](https://mkt.qa.katalon.com/webinars) [Reports](https://katalon.com/reports) [Software Testing Glossary](https://mkt.qa.katalon.com/software-testing-glossary) [Write for us](https://katalon.com/katalon-guest-post-guidelines) [What is Agentic QA?](https://mkt.qa.katalon.com/resources-center/blog/what-is-agentic-qa-the-complete-guide-for-2026)

Support

[Documentation](https://docs.katalon.com) [Community](https://forum.katalon.com) [Technical Support](https://katalon-inc.my.site.com/support/) [Training and Certification](https://academy.katalon.com/) [Sample Projects on GitHub](https://github.com/katalon-studio)

Company

[About Katalon](https://mkt.qa.katalon.com/about-us) [Events](https://mkt.qa.katalon.com/events) [News](https://mkt.qa.katalon.com/resources-center/blog/tag/news) [Brand Assets](https://mkt.qa.katalon.com/brand-assets) [Partners](https://mkt.qa.katalon.com/partners) [Careers](https://mkt.qa.katalon.com/careers) [Careers Blog](https://mkt.qa.katalon.com/careers/blog)

1720 Peachtree Street NW, Suite 870, Atlanta, GA 30309

General inquiries: [business@katalon.com](mailto:business@katalon.com)

Legal inquiries: [legal@katalon.com](mailto:legal@katalon.com)

Partnership inquiries: [partner@katalon.com](mailto:partner@katalon.com)

<https://www.facebook.com/KatalonPlatform> <https://twitter.com/KatalonPlatform> <https://www.linkedin.com/company/katalon/> <https://www.youtube.com/@KatalonTruePlatform>

[Legal](https://mkt.qa.katalon.com/terms) [Privacy](https://mkt.qa.katalon.com/terms#privacy-policy) [Security](https://mkt.qa.katalon.com/security)

Do Not Sell or Share My Personal Information

Copyright © 2026 Katalon, Inc. All rights reserved.

Click

![Katalon](https://mkt.qa.katalon.com/hubfs/contact-us-modal-2026/logos/katalon-horizontal-white-green.svg)

## Talk to someone who knows testing

Tell us what you are trying to solve and we will bring the right specialist to the call.

A reply within one business day A walkthrough on your own scenarios No obligation, and no sales sequence

**4.5** on G2 Trusted by 30,000+ quality teams

Thank you! We will contact you soon.

Click

Thanks for reaching out!

 We'll contact you shortly via email.   
In the meantime, you can start exploring with a 30-day trial of Studio Enterprise.

<iframe src="https://demo.arcade.software/vRJKNvm3VUmzeJknwpDi" title="Katalon Studio Tutorials" loading="lazy" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

Your 30-day trial comes with:

![Icon](https://d1h3p5fzmizjvp.cloudfront.net/themes/katalon_4/images/pages/signup_dec2023/benefit_ticket_icon.svg)

Full access to Studio Enterprise

![Icon](https://d1h3p5fzmizjvp.cloudfront.net/themes/katalon_4/images/pages/signup_dec2023/benefit_ticket_icon.svg)

Web, mobile, desktop, API testing

![Icon](https://d1h3p5fzmizjvp.cloudfront.net/themes/katalon_4/images/pages/signup_dec2023/benefit_ticket_icon.svg)

Easy setup, 1-click integrations

![Icon](https://d1h3p5fzmizjvp.cloudfront.net/themes/katalon_4/images/pages/signup_dec2023/benefit_ticket_icon.svg)

No credit card required

[Download Studio Enterprise](https://mkt.qa.katalon.com/download)