Blog / What Is Black Box Testing? Techniques, Types and Limits
Guide

What Is Black Box Testing? Techniques, Types and Limits

Black box testing judges software by its outputs, never its code. Learn the five techniques, the three types and the levels it covers, with worked examples.

Black box testing checks software only by what it does. You give it an input and compare the output with the requirement, without opening the code. I once told one of our engineers, who was arguing for his design over another, that I didn’t care what happened inside the box as long as the output was the same. His answer was speed, which is an output too.

You may know the technique names and still not know which inputs to try, or when to stop. Here is how to turn written rules into cases you can count, at any level from one function to a full release, and what those cases can’t prove even when all of them pass.

What you’ll learn

  • What black box testing is, and the levels it applies to
  • Five techniques worked through one example, and where else each one applies
  • The three types of black box testing and what each one checks
  • What passing black box cases can’t tell you, and when white or gray box testing takes over

What Is Black Box Testing?

Black box testing, also called specification-based testing, designs and judges tests from what the software is supposed to do, with no view of how it does it. The NIST glossary describes it as testing that “examines the functionality of an application without peering into its internal structures or workings,” and notes that it can be applied to virtually every level of testing: unit, integration, system and acceptance.

Every black box test needs an expected result written down before it runs. On a product team it lives in the spec, the ticket or the acceptance criteria. Without one, the tester’s guess becomes the spec, and two testers can pass and fail the same screen. The spec is the other half of every test.

In one line

Black box testing compares what software does with what its spec says it should do, using inputs and outputs only.

Black Box Testing at Every Level, From a Function to a Release

The box can be as small as one function or as large as the whole product. What stays fixed is the rule: you test through the inputs and outputs the spec names, whatever size the box happens to be.

LevelThe boxA black box check
UnitOne function, through its documented inputs and return valueformatPrice(1999) returns “$19.99”, whatever the code inside does
IntegrationTwo services, through the API contract between themAn order sent with an expired card gets the error code the contract names
SystemThe whole product, through its screens and the messages it sendsA new user signs up and receives exactly one verification email
AcceptanceThe product against the business need, judged by users or ownersA store manager issues a refund without calling support

The techniques below work the same way at every level. Only the inputs change, from function arguments to API requests to clicks on a screen.

5 Black Box Testing Techniques, With Worked Examples

Each technique answers a different question about which inputs to try, and each one works on anything with written rules: a form, an API, a pricing engine. To show how they stack, we’ll run all five against one sign-up form, because a form packs ranges, combinations and states into one screen, then say where else each technique pays off. The spec below is this post’s own example, written the way a product ticket might be.

#RuleWhat the spec says
1EmailRequired, and must look like an email address
2Password8 to 64 characters
3TermsThe terms box must be ticked
4New emailCreate a pending account, show “Check your inbox” and send a verification link
5Verification linkWorks once and expires after 24 hours. A resend replaces the old link, and a pending account can’t sign in until a link is used
6Email already registeredShow the same “Check your inbox” screen, then email a sign-in link if the account is verified, or a fresh verification link if it isn’t

1. Equivalence Partitioning

Equivalence partitioning splits each input into classes the spec treats the same way, then tests one value per class. If the spec accepts a 12-character password, it accepts a 20-character one for the same reason, so testing both buys nothing.

The password has one valid class, 8 to 64 characters, with an invalid class on each side of it. The email has four: well formed and new, well formed and already registered, malformed, and empty. EP1 keeps every input valid, and each other case moves one input into an invalid class, so a failure points at one field. The registered-email class gets its own cases in the decision table below.

CaseEmailPasswordExpected
EP1[email protected]12 characters”Check your inbox”
EP2new.example.com12 charactersEmail error, no account created
EP3[email protected]5 charactersPassword length error
EP4[email protected]80 charactersPassword length error
EP5(empty)12 charactersEmail error, no account created

Five cases stand in for every email and password the form will ever see. The malformed email in EP2 is also your first negative test, an input the form must refuse.

The same split covers an API parameter, the file types an upload accepts or the tiers of a discount rule. Wherever the spec groups inputs, one value per group is the floor.

2. Boundary Value Analysis

Partitions say which classes exist. Boundaries say where the bugs sit between them. Code that checks length > 8 where the spec meant length >= 8 passes every case above, because 5 fails, 12 passes and 80 fails as expected. Only a password of exactly 8 characters catches it.

So test each edge from both sides, 7 and 8 at the bottom and 64 and 65 at the top. Partition cases can’t see an off-by-one, so these four are the cheapest catches in the set. Every number a spec sets is an edge of this kind, from a free-shipping threshold to a date range, a rate limit or a maximum file size.

CasePassword lengthExpected
BV17Rejected
BV28Accepted
BV364Accepted
BV465Rejected

3. Decision Table Testing

Rules 3, 4 and 6 interact. A decision table lists each combination of conditions with the outcome the spec requires. Three yes-or-no conditions make eight combinations, but once the terms box is unticked nothing else matters, and a new email has no verification status to check. The eight collapse to four rules.

Condition or outcomeRule ARule BRule CRule D
Terms tickedNoYesYesYes
Email already registeredAnyNoYesYes
Existing account verifiedAnyNot applicableYesNo
Screen showsTerms errorCheck your inboxCheck your inboxCheck your inbox
Email sentNoneVerification linkSign-in linkFresh verification link

Rules B, C and D show the same screen. A tester who only watches the screen passes all three, even if a verified user gets a verification link instead of a sign-in link. The inbox is an output too, so a case for this form isn’t finished until it reads the email. Rule B is EP1 run again with the inbox checked, so it counts once, and the table adds three new cases.

Pricing, eligibility and permission rules are where decision tables pay off most, because their conditions combine faster than anyone can hold in their head.

4. State Transition Testing

Rule 5 describes states rather than inputs. An account moves from no account, to pending, to active, and a pending account’s link can run out. State transition testing maps those states and tests every move between them, including the moves that shouldn’t work.

CaseStarting stateActionExpected
ST1No accountSubmit a valid formPending, link sent
ST2PendingOpen the link within 24 hoursActive
ST3PendingOpen the link after 24 hoursRefused, account still pending
ST4PendingResend, then open the first linkFirst link refused, new link works
ST5ActiveOpen the same link againRefused, account stays active
ST6PendingTry to sign inRefused until a link is used

ST1 is EP1 once more, so this table adds five new cases. The moves that shouldn’t work find the bugs. A first link that still works after a resend gives the account two keys. A test run can’t wait 24 hours either, so teams add a test-only way to expire a link. The hook is the first place black box testing borrows something from inside the box.

Orders, subscriptions, support tickets and anything else with a status field have the same shape. Map the states, then test the moves the spec forbids.

5. Error Guessing

Error guessing starts from experience instead of the spec. You list the mistakes forms like this one tend to have, then try each. The ISTQB Foundation Level syllabus keeps experience-based techniques in a section of their own, apart from its black-box test techniques. For this form, five guesses earn a case:

  • EG1: A pasted email with a trailing space, which should be read as the same address.
  • EG2: An account for [email protected] exists, then [email protected] is submitted, which should count as the same email.
  • EG3: A double click on Create account, which should create exactly one account.
  • EG4: A 64-character password made of emoji, which shows whether the limit counts characters or bytes.
  • EG5: A plus address such as [email protected], which should be accepted even though an over-strict email check would refuse it.

None of these is in the spec. Error guessing finds the rules nobody wrote down, and EG2 is a rule the product team should add before the next release. On other features the reliable guesses change, to time zones, a retry after a timeout or two people editing the same record.

TechniqueQuestion it answersNew cases
Equivalence partitioningWhich classes of input does the spec treat differently?5
Boundary value analysisIs each edge in the right place?4
Decision tableDoes each combination of rules get its outcome?3
State transitionDoes each step of the account’s life behave, including the wrong ones?5
Error guessingWhat did the spec forget?5
Total5 + 4 + 3 + 5 + 522

Counted once each, the form needs 22 cases, and each has a reason you can say out loud. Any of them can be run by hand or by a script, and choosing between the two is a manual vs automated testing question that turns on how often each case has to run.

What Are the Types of Black Box Testing?

The techniques decide which inputs to try. The type decides what you’re checking with them, and the same sign-up cases can serve all three.

  1. Functional testing checks that features follow the spec, which is everything in the section above. Most functional testing software, from browser scripts to codeless recorders, automates this loop of entering inputs and reading results.
  2. Non-functional testing measures qualities from the outside: how long sign-up takes, whether it holds up during a launch-day spike, whether a screen reader user can finish it. Speed was the engineer’s answer in the intro, and you can time a form without opening it. Black box security testing sits here too, as when a penetration tester with no code access probes the live form for weaknesses.
  3. Regression testing re-runs earlier cases after a change. The 22 cases written for launch become the check that next quarter’s redesign didn’t move the 8-character boundary.

Tag each case with its type when you write it. Building the regression set later is then a filter, not a rewrite.

Black Box vs White Box Testing: What 22 Passing Cases Can’t Tell You

Say all 22 cases pass. You know the form meets its spec at every point the cases touched, and nothing about the code that got it there. Black box coverage is counted against requirements, one case or more per rule. Code coverage counts the lines and branches that ran, and no number of outside cases tells you which ones those were.

QuestionCan the 22 cases answer it?What answers it instead
Does sign-up meet the written spec?YesThese cases
Did a code path go unrun, such as a branch for invited users?NoA coverage tool on your test run
Was the password stored hashed?NoReading the code, or querying the database
Does the link expire at 24 hours, tested without waiting a day?Only with a test hookA test-only control over the clock
Is the spec itself right?Only where error guessing found a gapA product review of the rules

The second and third rows belong to other approaches. White box testing designs cases from the code itself, which is how a team finds the invited-user branch no sign-up case ever reached. A tester who submits the form and then checks the new account’s row in the database is doing gray box testing, judging an outside action with partial inside knowledge, and the test-only clock from ST3 is the same move.

ApproachDesigned fromTester seesAnswers
Black boxThe spec and its expected outputsInputs and outputs only, the screen and the emailDoes the product do what the spec says?
White boxThe codeThe source, its branches and its pathsWhich code did the tests run?
Gray boxThe spec plus partial inside knowledge, such as a schemaOutputs plus chosen internals, such as a database rowDid the action land correctly behind the screen?

Look, none of this is a case against black box testing. Run black box cases for what the product promises and white box coverage for what the code contains, because neither number can stand in for the other.

Pie Writes the Flow Tests and Checks Them Where Users Look

Twenty-two cases is the count for one form, and your product has more than one form. Writing the cases is a one-time cost. Running them is a cost you pay again on every release, and it grows with every form you add. The dull cases, the 64-character edge and the unticked terms box, are the ones that drop out of a suite when time runs short.

We built Pie for that second cost. It’s an agentic testing platform, built AI-native, that tests web apps and native mobile apps on iOS and Android. Pie explores your app from its screens and writes tests for what it reaches. Each test is a list of plain steps your team can open and change.

  • Verdicts on the screen: A test passes or fails on what a user would see, such as the error under the password field or the page after Create account. For supported tests, nobody on your team writes or maintains selectors, because Pie’s self-healing tests find each field on the screen.
  • Your edge cases too: Describe the 65-character password in Pie Chat and you get a test for it, so the cases your spec names run beside the flows Pie found.
  • Pull requests: Pie can test your pull requests once a repository is connected, as long as each change has a preview deployment or a build you’ve uploaded.

Write the Spec Down Before You Test

Four of the five techniques worked from a written rule, and the fifth exists to find the rules the spec left out. Either way the spec is where testing starts, and the feature that’s hardest to test is the one whose rules live in somebody’s head.

Pick one feature in your product this week, a form, an endpoint or a pricing rule. Write its rules in a few lines, run the five techniques against them and count the cases. The gap between that count and what your suite checks today is your next round of testing work.

Put Your Spec to Work

Keep the rules your team wrote. Get flow tests for web, iOS and Android that pass or fail on the screen your users see.

Frequently Asked Questions

Black box testing checks software only through its inputs and outputs. The tester enters data, triggers an action and compares what happens with the requirement, without reading the code. A sign-up form, for example, is tested by submitting values and checking both the screen and the email it sends.
Black box testing designs cases from the spec and judges outputs, with no view of the code. White box testing designs cases from the code itself, aiming to run its statements and branches. Black box shows whether the product meets the spec. White box shows which code the tests reached.
A gray box tester works from the outside with partial knowledge of the inside, such as the database schema or an API contract. They might submit a sign-up form, then query the database to check the new account. A black box tester judges only what the system shows or sends.
Write the requirement down, then pick cases with a technique, such as equivalence partitioning for classes of input, boundary values for edges, decision tables for combinations of rules and state transitions for sequences. Run each case, compare the result with the spec and record pass or fail.
Functional testing checks that features follow the spec. Non-functional testing measures qualities such as speed, behavior under load and usability from outside the system, including black box security testing such as a penetration test without code access. Regression testing re-runs earlier cases after a change.
Both. Any black box case can be run by a person following written steps, or by a script or tool that enters the inputs and checks the outputs. Cases that run on every release are good candidates to automate. Exploratory and one-off checks often stay manual.
Testers, developers and end users can all do it, because it needs no access to the code. QA teams run it at the system level, developers can write black box unit tests against a function's documented behavior, and users do a version of it during acceptance and beta testing.
Describe the case to Pie Chat, for example a 7-character password or an unticked terms box, and Pie turns it into a test. It runs beside the tests Pie generated from exploring your app, and your team can edit any of them.
Dhaval Shreyas
Dhaval Shreyas
CEO & Co-founder at Pie

13 years building mobile infrastructure at Square, Facebook, and Instacart. Now building the QA platform he wished existed the whole time. LinkedIn →