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.
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.
| Level | The box | A black box check |
|---|---|---|
| Unit | One function, through its documented inputs and return value | formatPrice(1999) returns “$19.99”, whatever the code inside does |
| Integration | Two services, through the API contract between them | An order sent with an expired card gets the error code the contract names |
| System | The whole product, through its screens and the messages it sends | A new user signs up and receives exactly one verification email |
| Acceptance | The product against the business need, judged by users or owners | A 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.
| # | Rule | What the spec says |
|---|---|---|
| 1 | Required, and must look like an email address | |
| 2 | Password | 8 to 64 characters |
| 3 | Terms | The terms box must be ticked |
| 4 | New email | Create a pending account, show “Check your inbox” and send a verification link |
| 5 | Verification link | Works 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 |
| 6 | Email already registered | Show 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.
| Case | Password | Expected | |
|---|---|---|---|
| EP1 | [email protected] | 12 characters | ”Check your inbox” |
| EP2 | new.example.com | 12 characters | Email error, no account created |
| EP3 | [email protected] | 5 characters | Password length error |
| EP4 | [email protected] | 80 characters | Password length error |
| EP5 | (empty) | 12 characters | Email 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.
| Case | Password length | Expected |
|---|---|---|
| BV1 | 7 | Rejected |
| BV2 | 8 | Accepted |
| BV3 | 64 | Accepted |
| BV4 | 65 | Rejected |
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 outcome | Rule A | Rule B | Rule C | Rule D |
|---|---|---|---|---|
| Terms ticked | No | Yes | Yes | Yes |
| Email already registered | Any | No | Yes | Yes |
| Existing account verified | Any | Not applicable | Yes | No |
| Screen shows | Terms error | Check your inbox | Check your inbox | Check your inbox |
| Email sent | None | Verification link | Sign-in link | Fresh 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.
| Case | Starting state | Action | Expected |
|---|---|---|---|
| ST1 | No account | Submit a valid form | Pending, link sent |
| ST2 | Pending | Open the link within 24 hours | Active |
| ST3 | Pending | Open the link after 24 hours | Refused, account still pending |
| ST4 | Pending | Resend, then open the first link | First link refused, new link works |
| ST5 | Active | Open the same link again | Refused, account stays active |
| ST6 | Pending | Try to sign in | Refused 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.
| Technique | Question it answers | New cases |
|---|---|---|
| Equivalence partitioning | Which classes of input does the spec treat differently? | 5 |
| Boundary value analysis | Is each edge in the right place? | 4 |
| Decision table | Does each combination of rules get its outcome? | 3 |
| State transition | Does each step of the account’s life behave, including the wrong ones? | 5 |
| Error guessing | What did the spec forget? | 5 |
| Total | 5 + 4 + 3 + 5 + 5 | 22 |
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.
- 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.
- 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.
- 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.
| Question | Can the 22 cases answer it? | What answers it instead |
|---|---|---|
| Does sign-up meet the written spec? | Yes | These cases |
| Did a code path go unrun, such as a branch for invited users? | No | A coverage tool on your test run |
| Was the password stored hashed? | No | Reading the code, or querying the database |
| Does the link expire at 24 hours, tested without waiting a day? | Only with a test hook | A test-only control over the clock |
| Is the spec itself right? | Only where error guessing found a gap | A 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.
| Approach | Designed from | Tester sees | Answers |
|---|---|---|---|
| Black box | The spec and its expected outputs | Inputs and outputs only, the screen and the email | Does the product do what the spec says? |
| White box | The code | The source, its branches and its paths | Which code did the tests run? |
| Gray box | The spec plus partial inside knowledge, such as a schema | Outputs plus chosen internals, such as a database row | Did 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.