Black-box testing looks only at inputs and outputs and ignores how the code is written. White-box testing reads the code and its branches. Grey-box testing sits between them: the tester knows some internal information — APIs, logs, data structures, analytics events — without reading the implementation line by line. All three test the same feature; what differs is how much internal information you hold, and therefore which questions you can ask. Choosing wrong has a concrete cost. Use black box on a problem only grey box can see — a field type that changed, say — and a hundred runs will not find it. Insist that business testers read code and testing becomes a side job for developers.
The three boxes compared
| Dimension | Black box | Grey box | White box |
|---|---|---|---|
| Internal knowledge | Almost none: requirements and UI | APIs, logs, data structures, part of the implementation | Full code and structure |
| What it verifies | Whether behaviour matches expectations | Behaviour plus internal consistency | Branches, boundaries, coverage |
| Who does it | Business testers, PMs, customer success | Testers who know the API, developers | Developers |
| Typical techniques | Equivalence partitioning, boundary values, decision tables, state transition, pairwise | API checks, log verification, analytics validation, contract tests | Unit tests, coverage, static analysis |
| Cost | Lowest; can start immediately | Medium; needs an environment and docs | Highest; requires reading code |
| What it misses | Problems that appear only with specific data or environments | Cross-system timing issues | Problems users never notice |
The five black-box techniques
Using a login form as the example:Grey box in a web team, concretely
You do not need to read code. Developer tools are enough:- Requests: confirm in Network that the API returns 200 with a changed field, or just 4xx / 5xx;
- Errors: the red text in Console is usually closer to the cause than the UI symptom;
- Contracts: the API doc says
price: number, the response carries"12.00"— only grey box sees this;
- Analytics: an event that never fires is invisible in the UI, but it corrupts decisions.
Why black-box reports get bounced
Missing evidence. The same problem, two ways:| Version | What the developer does next |
|---|---|
| "Login does nothing" | Asks which account, which browser, and whether the console shows anything |
"Chrome 141 / Windows 11, test account A enters the correct password at https://example.com/login and the page does not navigate; Network shows POST /api/login returning 500, Console shows Unhandled promise rejection" |
Goes straight to the server logs |
When black box is enough, when grey box is not optional
| Situation | Recommendation | Why |
|---|---|---|
| Accepting a new feature against requirements | Black box | You are verifying behaviour, not implementation |
| Pre-release regression walkthrough | Black box plus grey box on critical paths | Flow by behaviour, login and payment by request |
| API field changes, integration work | Grey box | The UI can look fine while the data is already wrong |
| Performance and timeouts | Grey box | You need request durations and failure rates |
| Security and permissions | Mostly grey box | Privilege escalation is usually invisible in the UI |
| Static pages, copy changes | Black box | There is no internal chain to inspect |
One example: a payment callback through three lenses
The same symptom, three depths of answer.- Black box sees: the customer pays successfully, the order still says "pending". Behaviour does not match expectation; file a bug.
- Grey box sees: Network shows
POST /api/pay/callbackreturning 200, but the body carriesstatus: "pending"; the console is clean. The problem sits in server-side state handling, not the front end.
- White box sees: the callback handler writes a log first and updates the order second; the update failure is swallowed by an empty
catch. That is a logic defect, and there are probably more of the same kind.
Putting the boxes into the test plan
| Stage | Main box | Output |
|---|---|---|
| After requirements review | Black box | Case design and acceptance criteria |
| Integration, first build | Grey box | Contract checks, field and error-code inventory |
| Pre-release regression | Black box plus grey box on critical paths | Regression checklist, request snapshots for critical paths |
| After release | Grey box (logs and monitoring) plus black box (real feedback) | Alert rules, user reports |
Three preconditions for grey box
Grey box is not something you can simply decide to do. Miss one of these and it degrades back into black box:Three misconceptions
- White box equals unit tests: unit tests are the most typical use, but white box also covers code review, coverage analysis and static scanning.
- Grey box means reading code: the core of grey box is knowing some internal information. Reading logs and requests counts; reading the implementation does not.
- Automation equals white box: UI automation is usually black box (it only operates the interface), API automation is closer to grey box. Technique and box are different axes.