Black Box vs Grey Box vs White Box Testing

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
One fact teams overlook: most of what a web team does day to day is grey box, it just is not called that. Opening the Network panel to read a status code, or the Console to read an error, is already using internal information.

The five black-box techniques

Using a login form as the example:
  • Equivalence partitioning: split inputs into "valid phone number / invalid format / empty" and take one representative from each.
  • Boundary values: a password of 8–20 characters means testing 7, 8, 20 and 21.
  • Decision tables: combine "account exists × password correct × account locked" and verify each row.
  • State transition: unverified → verified → locked, checking every path and every illegal jump.
  • Pairwise: browser × OS × language × role, two at a time, covering the most combinations with the fewest cases.
  • None of these needs internal knowledge, yet together they turn "click around for a bit" into a reusable case set. How to write the cases is in Test Case Templates with Examples.

    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.
    What these four share: none of them is a "user-visible symptom", and every one of them decides whether the bug gets fixed and by whom.

    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
    The difference is not writing skill. It is whether the three grey-box facts came along: environment, failed request, error text. There is a real tension here: black-box testers — business users, support, customers — should not be asked to read the console. The answer is not training, it is automatic capture: install a browser extension, or embed a feedback entry on the site, and let the tool carry the console errors, failed requests, browser and viewport along with the report. That is the layer BugCapturer provides: the tester stays black box, the report arrives with grey-box detail.

    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
    White box is absent from this table because it is rarely the tester's job: unit tests, coverage and static analysis belong to the developer's self-check and run on a different track from acceptance testing.

    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/callback returning 200, but the body carries status: "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.
    The practical conclusion: a report that reaches the second level lets a developer start immediately; a report stuck at the first level costs three rounds of questions. Reaching level two does not require reading code — only attaching that one request.

    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
    The division of responsibility is the point: black box answers "is it right", grey box answers "why is it wrong", white box answers "is the code itself risky".

    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:
  • Access to the environment: the test environment is reachable and the account has permissions, or you cannot even send the request.
  • Visibility into logs and requests: developer tools at minimum, server logs ideally.
  • Knowledge of the contract: fields, error codes and required values are documented or someone can answer.
  • The third is the one most often missing. Without a contract, a tester can judge "is the page right" but not "is the data right" — which is exactly how field-level problems reach production.

    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.

    FAQ

    Does black-box testing require technical skill? Not code, but it does require describing symptoms precisely, preparing data, and judging whether something is expected behaviour. The remaining evidence can come from a tool. Does grey-box testing need API documentation? It helps, but it is not required: opening the Network panel and reading real requests and responses is already grey box. Can a small team do black box only? Yes, with two additions: check the critical-path requests before release, and let reports carry console errors and failed requests automatically. Both cost far less than hiring a dedicated grey-box tester. Are the three boxes mutually exclusive? No. It is common to use black box at acceptance, grey box during integration and white box for developer self-checks on the same feature. How do I tell whether a report is "grey box enough"? Ask whether a developer can start investigating without asking anything: environment, failed request, error text. If all three are there, it is.