# White box testing

> White Box Testing: What It Is and When It Pays Off. Canonical page: <https://zapple.tech/glossary/white-box-testing/>

White box testing designs tests from the internal structure of the code, so you can check that its statements and branches actually run. It suits developers and the code you control. It shows which code no test has touched, but it cannot show that the code does what users need, or that a tested line is tested well.

## What do the white box coverage measures count?

The [ISTQB syllabus](https://istqb.org/wp-content/uploads/2024/11/ISTQB_CTFL_Syllabus_v4.0.1.pdf) says white-box testing "is structure-based and derives tests from the system's implementation or internal structure (e.g., code, architecture, work-flows, and data flows)". [NIST](https://csrc.nist.gov/glossary/term/white_box_testing) words it from the assessor's side: a methodology that "assumes explicit and substantial knowledge of the internal structure and implementation detail of the assessment object". The coverage measures below say how much of that structure your tests touched.

| Measure | What it counts | What it misses | Tool example |
|:--|:--|:--|:--|
| Statement | Statements the tests executed | An `if` that was never false still counts as covered | coverage.py; JaCoCo counts lines and instructions |
| Branch | Branches the tests executed | Defects that need a specific path through the code | [JaCoCo](https://www.jacoco.org/jacoco/trunk/doc/counters.html) branches, coverage.py |

The syllabus says that branch coverage subsumes statement coverage, and that 100% statement coverage does not ensure all the decision logic has been tested. [Coverage.py](https://coverage.readthedocs.io/en/latest/branch.html) shows the gap between the two: statement coverage can mark every line of a function as executed while the `if` was never evaluated as false, which only branch coverage flags as a "partial branch".

## How is white box testing different from static testing?

The two answer different questions. White box testing names what the tests are designed from: the code's structure. [Static testing](/glossary/static-testing/) names how the check is done: without running the code, through reviews and analysis tools. The ISTQB syllabus notes that white-box techniques can also be used in static testing, for example in dry runs of code. Our [AI code review checklist](/blog/types-of-automation-testing/ai-code-review-checklist/) is an example of static testing.

## Who should do white box testing: developers or a QA team?

The ISTQB foundation syllabus names no role for white-box testing. This is our judgement from practice.

- **Developers** should own it for code they write. They can see the structure and fix the gap in the same change. Unit tests written with [test-driven development](/blog/test-automation-frameworks/what-is-test-driven-development/) give you coverage as a side effect, in our experience.
- **A QA team** adds most when it reads coverage reports as a map of risk, asks why a critical module has gaps and checks that tests assert something. Microsoft's [Azure Well-Architected testing guidance](https://learn.microsoft.com/en-us/azure/well-architected/operational-excellence/testing) says to "Generate coverage reports to identify gaps in automation." We would not ask testers to write white box tests for code they cannot read.
- **An outside reviewer** helps when nobody on the team trusts the numbers. A [QA audit and assessment](/services/audit-and-assessment/) looks at your tests, pipeline and release process and reports what is at risk and what to fix first.

For tools, see our list of [unit automation testing tools](/blog/types-of-automation-testing/list-of-the-best-unit-automation-testing-tools/).

## What coverage figure is worth asking for, and what does a high figure not tell you?

We do not recommend one percentage for every product. Ask for these instead.

1. **Coverage on the code that matters.** A figure for the payment module says more than one for the whole repository.
2. **Branch coverage, not only statement coverage.** The coverage.py example above shows why.
3. **No drop on a change.** A rule that coverage may not fall on a pull request is easier to keep than a target.
4. **Assertions that can fail.** A test that runs a line without checking a result raises coverage and proves nothing. [Mutation testing](/glossary/mutation-testing/) checks for this by changing the code and seeing whether tests notice.

A high figure says the lines ran. It does not say the behavior is right, that requirements are met, or that missing features exist. Pair it with [black box testing](/glossary/black-box-testing/) and our guide to [automating white and black box tests with Selenium](/blog/test-automation-frameworks/how-to-automate-white-and-black-box-testing-using-selenium/).

## What does Zapple.Tech do about it?

If you do not know whether your coverage figure means anything, start with the evidence. Zapple.Tech starts with a one-week QA audit of one product area. It looks at its tests, pipeline and release process, and ends in a written report on what is at risk and what to fix first, plus a pilot plan you can run with Zapple.Tech or without it. Read more on the [QA audit and assessment](/services/audit-and-assessment/) page. Tell us about your product in the form below.

## FAQ

### What is white box testing?

The ISTQB syllabus says white-box testing is structure-based and derives tests from the system's implementation or internal structure, such as code, architecture, work-flows and data flows. The tester uses the code and its branches to decide which tests to write, and a coverage tool reports which parts the tests reached.

### What is the difference between white box and black box testing?

White box testing designs tests from the internal structure of the code. Black box testing designs them from the specification or the behavior, without looking inside. White box finds code that no test reaches. Black box finds behavior that does not match what was asked for. They answer different questions, so you can use both.

### What are the white box testing techniques?

The ISTQB foundation syllabus covers two, statement testing and branch testing. It says the more rigorous techniques are not discussed in it. Each is measured by a coverage figure for the part of the structure that tests have exercised. Mutation testing is a related check that changes the code to see whether the tests notice.

### Is unit testing white box testing?

In our judgement, often, but not always. A unit test is white box when its author picks the cases from the code's structure, for example to reach each branch. A unit test that checks only the public behavior of a function, without regard to its internals, is closer to black box.

## Sources

- [ISTQB Certified Tester Foundation Level syllabus v4.0.1, 2024-09-15 (pp. 27-30 and 42-43, read 2026-12-05)](https://istqb.org/wp-content/uploads/2024/11/ISTQB_CTFL_Syllabus_v4.0.1.pdf)
- [NIST CSRC Glossary, White Box Testing, from NIST SP 800-137, September 2011, final; no revision listed (read 2026-12-05)](https://csrc.nist.gov/glossary/term/white_box_testing)
- [JaCoCo documentation, Coverage counters (read 2026-12-05)](https://www.jacoco.org/jacoco/trunk/doc/counters.html)
- [Coverage.py 7.18.0 documentation, Branch coverage measurement (read 2026-12-05)](https://coverage.readthedocs.io/en/latest/branch.html)
- [Microsoft Learn, Azure Well-Architected Framework, Architecture strategies for testing (updated 2026-11-04, read 2026-12-05)](https://learn.microsoft.com/en-us/azure/well-architected/operational-excellence/testing)
