Best practices

What Is Black-Box Testing? Techniques, Types, and Examples

Key takeaways

  • Design black-box tests from requirements and user flows, not from the code.

    Tests built from what the software should do keep passing when developers rewrite the code behind a feature, and fail only when its behavior changes, which is the change users notice.

  • Pick inputs with equivalence partitioning and boundary values, so a few test cases cover a whole range.

    Test one value from each group the software should treat the same, plus the values at and just past each edge, where off-by-one mistakes hide.

  • Give every practical user flow an end-to-end test, the black-box test closest to what users do.

    It runs the flow through the app's real interface, with the real backend behind it, so it catches breaks that no test of a single part can see.

  • Run the automated black-box suite in parallel on every pull request.

    A parallel suite takes about as long as its longest test, so every change gets checked before it merges.

  • Pair black-box tests with the white-box unit tests developers write for their own code.

    Black-box tests show that something broke for users, and unit tests close to the code point to the logic that caused it.

Black-box testing checks what software does without looking at how its code works. The person or tool running a test gives the app inputs, through its screens, its API, or its command line, and compares the outputs with what the requirements say should happen.

The name comes from treating the software as a box you can't see into. A black-box test knows the inputs and the expected outputs, and nothing about the code, database, or architecture in between, so it keeps working through a rewrite of the code, as long as the feature still behaves the same way. It's also called specification-based testing, behavioral testing, or closed-box testing.

Most of the testing that shows whether users can get their work done is black-box testing, from functional tests and regression suites to acceptance tests and end-to-end tests, which run a complete user flow through the app's real interface. End-to-end tests are the kind QA Wolf's AI agents write, run, and maintain for web, mobile, and desktop apps.

How does black-box testing work?

Black-box testing turns what the software should do into inputs and expected results, runs the inputs through the same interface a user or another system would use, and compares what comes back. It works the same way whether a person runs the test by hand or a script runs it automatically.

  1. Start from what the software should do: requirements, user stories, acceptance criteria (the conditions a feature must meet to count as done), or an API's documentation. When nothing is written down, map what the app does today and confirm it with the people who own each feature.
  2. Choose the inputs and conditions to test: The techniques below pick a small set that still covers the behavior, invalid inputs and edge cases included.
  3. Write down the expected result for each one: Do it before running anything, so the result comes from the requirements instead of whatever the app happens to do.
  4. Run the test through the app's interface: its screens for a person or a browser automation tool, its API for a service, or its command line for a command-line tool.
  5. Compare the actual result with the expected one: A mismatch is either a bug, reported with the steps to reproduce it, or a test to update because the feature changed on purpose.

Whoever designs the test needs to know what the app should do, not how it's built. So QA engineers, product managers, and developers who never touched a feature's code can all design black-box tests for it, and they can design them before the feature exists.

Black-box testing is one of three approaches to software testing sorted by how much of the code the person testing can see. White-box testing designs tests from the code itself, for example to run every branch of a function, so its tests are mostly unit tests written by the developers who own the code. Gray-box testing sits in between, using some knowledge of the internals, such as the database schema, to design tests that still run from the outside.

What are the black-box testing techniques?

The main black-box testing techniques are equivalence partitioning, boundary value analysis, decision table testing, state transition testing, use case and user flow testing, pairwise testing, and error guessing. Each one is a way to choose a small set of test cases that still covers the behavior that matters, since testing every possible input is impossible.

TechniqueWhat it doesUse it for
Equivalence partitioningSplits inputs into groups the software should treat the same, and tests one value from eachFields and parameters that take a range or a set of values
Boundary value analysisTests the values at and just past each edge of a rangeAny limit, such as a length, an amount, a date, or a count
Decision table testingLists every combination of conditions and the result each should produceRules that combine several conditions
State transition testingTests each move between the states the software can be in, and that forbidden moves are refusedAnything whose response depends on what happened before, such as an account lockout
Use case and user flow testingTests a whole task a user does, start to finish, with the variations that change the outcomeEnd-to-end tests of the flows users depend on
Pairwise testingTests every pair of settings at least once, instead of every combinationFeatures with many options that interact
Error guessingUses experience of what usually breaks to pick inputsFinding the cases the other techniques miss

Equivalence partitioning

Equivalence partitioning splits the possible inputs into groups, or partitions, that the software should handle the same way, and tests one value from each group. If one value in a group works, the others should too, so testing more of them adds little.

Say a password field accepts 8–64 characters. That gives three partitions: too short (fewer than 8 characters), valid (8–64), and too long (more than 64). Three tests, with passwords of 5, 20, and 80 characters, cover them. Many teams treat an empty field as a fourth partition, since it usually gets its own error message.

Boundary value analysis

Boundary value analysis tests the values at each edge of a range and just past it, because that's where mistakes cluster. Code that checks for "more than 8" when the rule is "8 or more" gets only one value wrong, 8 itself, and only a test at the boundary finds it.

For the 8–64 character password field, the boundary values are 7, 8, 64, and 65 characters. The field should accept 8 and 64 and refuse 7 and 65. Some teams also test the values just inside each edge, 9 and 63. Boundary value analysis and equivalence partitioning are usually used together, with partitions for the groups and boundaries for their edges.

Decision table testing

Decision table testing lists every combination of the conditions a rule depends on, with the result each combination should produce, and turns each column into a test case. It catches the combinations nobody thought about when the rule was written.

For example, take a rule that lets admins edit any record and lets other users edit only records that aren't locked.

Condition or resultTest 1Test 2Test 3Test 4
The user is an adminYesYesNoNo
The record is lockedYesNoYesNo
The user can edit itYesYesNoYes

Two yes-or-no conditions give four combinations and four test cases, and each new condition doubles the count. For bigger rules, merge the columns where a condition doesn't change the result, such as tests 1 and 2 here, where an admin can edit either way.

State transition testing

State transition testing checks software whose response depends on what happened before. It lists the states the software can be in and the events that move it between them, then tests each allowed move and checks that the forbidden ones are refused.

For example, an account that locks after three wrong passwords has two states, active and locked. The tests check that two wrong passwords leave the account active, that a third locks it, that the right password doesn't log in to a locked account, and that a password reset unlocks it.

Use case and user flow testing

Use case testing checks a whole task a user does, start to finish, instead of one input at a time. QA Wolf calls these tasks user flows, meaning each distinct thing a user comes to do in an app, plus the variations that change the outcome.

For example, a sign-up flow covers registering, confirming the email address, and logging in for the first time, and its variations include an expired confirmation link and an email address that already has an account. Testing whole flows is what end-to-end tests do, and it finds the bugs that only show up when the parts of an app run together.

Pairwise testing

Pairwise testing, also called all-pairs testing, is for features with many settings that interact, where testing every combination would take too many tests. It rests on the idea that a bug caused by a combination of settings usually needs only two of them, so it tests every pair of values at least once.

For example, three user roles, three account plans, and four languages make 36 combinations, but every pairing of a role with a plan, a role with a language, and a plan with a language fits in 12 tests.

Error guessing

Error guessing uses experience of what usually breaks to choose inputs the other techniques don't produce. Common guesses include empty and very long values, special characters and emoji, spaces before or after a value, February 29, dates across time zones, pasting instead of typing, double-clicking a submit button, and going back in the middle of a flow.

It depends on who's doing the guessing, so it adds to the other techniques instead of replacing them. A person exploring a new feature without a script does a lot of error guessing, and every bug they find is a case worth turning into an automated test.

What are the types of black-box testing?

Black-box testing is a way of designing tests, so it shows up in every kind of testing that checks behavior from the outside. The main types are functional testing, non-functional testing, regression testing, end-to-end testing, acceptance testing, and security testing.

Functional testing

Functional testing checks that each feature does what its requirements say, by giving it inputs and checking the outputs. Most functional testing is black-box testing, since the tests come from the requirements rather than the code. The password field and the editing rule above are functional tests.

Non-functional testing

Non-functional testing checks qualities such as speed, behavior under load, usability, and accessibility for people who use assistive technology. Load testing, for example, measures how fast an app responds with many users signed in at once. These tests measure the app from the outside too, usually against a target the team sets.

Regression testing

Regression testing re-runs tests of features that already work after every change, to catch regressions, bugs where something that used to work breaks. Its tests are black-box tests of existing behavior, so they stay valid while the code changes underneath them, and they're the tests most worth automating, since they run again on every change. A smoke test suite is a small set of them covering the most important flows, run after a build or deploy to decide whether the rest of the testing is worth doing.

End-to-end testing

End-to-end testing runs a complete user flow through the app's real interface, with the real backend, database, and third-party services behind it, and checks what the user would see. It's black-box testing of the whole product, and the only kind that shows whether a user can finish what they came to do.

End-to-end tests are written with automation frameworks, such as Playwright for web apps and Appium for mobile and desktop apps, that drive the app from the outside the way a user does. On mobile, black-box frameworks like Appium run outside the app, so they can also tap system dialogs and notifications, which frameworks that run inside the app can't reach.

Acceptance testing

User acceptance testing (UAT) has the business or the software's real users confirm that it does what they need before release. They judge the software only by what it does for them, so acceptance testing is black-box testing by nature. Many teams also write their acceptance criteria as automated tests, so the same checks run on every later release.

Security testing

In security, black-box testing means probing an app from the outside with no inside knowledge, the way a real attacker would. Dynamic application security testing (DAST) scanners send malicious requests to a running app and watch for vulnerabilities such as injection flaws, and in a black-box penetration test, security specialists try to break in starting from nothing but the app's public address. It's a separate discipline from the functional testing on this page, run by security teams and specialists.

What is an example of black-box testing?

A sign-up form is a typical example. Say the form accepts passwords of 8–64 characters and refuses an email address that already has an account. Black-box test cases for it, chosen with the techniques above, look like this.

Test caseInputExpected resultTechnique
Typical passwordA new email address and a 20-character passwordThe account is created and the user is signed inEquivalence partitioning
Empty passwordA new email address and no passwordThe password field is flagged as requiredEquivalence partitioning
Shortest valid passwordAn 8-character passwordThe account is createdBoundary value analysis
One character too shortA 7-character passwordAn error says the password needs at least 8 characters, and no account is createdBoundary value analysis
Longest valid passwordA 64-character passwordThe account is createdBoundary value analysis
One character too longA 65-character passwordAn error says the password can have at most 64 characters, and no account is createdBoundary value analysis
Email already registeredAn email address that already has an accountAn error says the address is taken, and no second account is createdEquivalence partitioning
Spaces around the emailA new email address with a space before and after itThe spaces are trimmed and the account is createdError guessing

Every test case is written in terms of what a user types and sees, so anyone who knows the product can review the list, and it can be written before the form is built.

Black-box testing works the same way on an API. A test calls an endpoint the way a client would and checks the response, without reading the service's code. For example, a request for another user's private record should come back with an error status, such as 403 or 404, and none of the record's data.

An end-to-end test applies black-box testing to a whole user flow. In an app with team workspaces, a test of inviting a teammate could be outlined in Arrange-Act-Assert steps, which list the state to set up, the action a user takes, and the result to check:

  • Arrange: Log in as the admin of a workspace with an open seat.
  • Act: Invite a new email address, then open the invitation email and accept it as the new user.
  • Assert: The new user lands in the workspace as a member, and the admin's member list shows them.

The test never touches the code that sends the email or saves the membership. It passes when a real user could invite a teammate, and fails when they couldn't, whichever part broke. Both checks in the Assert step can be soft assertions, which record a failure and let the test keep going, so one run reports every check that failed.

What are the advantages and disadvantages of black-box testing?

Black-box testing's main advantage is that it checks what users actually get, whatever the code looks like inside, and its main disadvantage is that a failed test shows that something broke but not why.

Black-box tests check what users actually get

  • They test the app as people use it: A passing black-box test means the feature works from the outside, with all its parts running together, which a passing unit test can't promise.
  • They survive rewrites of the code: The tests don't depend on how the code is structured, so developers can rewrite a feature's internals without rewriting its tests, and a failure means the behavior changed.
  • Anyone who knows the product can design them: QA engineers, product managers, and support teams can write test cases without reading code, and from the requirements, before the code exists.
  • They catch misread requirements: The tests come from the requirements, so they catch a feature that works exactly as its developer understood it and still isn't what was asked for.

Black-box tests can't see why something broke

  • A failure doesn't point to the cause: A black-box test shows that a flow broke, not which line of code or which service caused it, so every failure needs investigating.
  • They can't see untested code: Without the code, there's no way to tell which branches the tests never reach, such as an error handler that only runs when a third-party service times out.
  • They need to know the right answer: When requirements are vague or missing, someone has to work out what the correct result is before a test can check it.
  • Tests through the interface need upkeep: They break when the interface changes on purpose, so someone has to update them, and they can turn flaky, passing and failing with no change to the code, when they don't wait for the app to be ready.
  • They take longer to run: A test of a whole user flow takes far longer than a unit test, which runs in milliseconds, so a large black-box suite has to run in parallel to keep up with every change.

What tools are used for black-box testing?

Black-box testing tools fall into a few kinds, and each drives the software from the outside through a different interface.

  • Browser automation frameworks: They drive a web app through a real browser, clicking and typing the way a user does. Playwright is the one QA Wolf recommends for web apps.
  • Mobile and desktop automation frameworks: They drive iOS, Android, Windows, and macOS apps from outside the app. QA Wolf's agents write these tests in Appium.
  • API testing tools: They send requests to an API and check the status codes and data that come back.
  • Load testing tools: They simulate many users at once and measure response times and errors.
  • Security scanners: They probe a running app for vulnerabilities from the outside.
  • Test management tools: They store test cases and record the results of tests that people run by hand.

How do you do black-box testing well?

Do black-box testing well by designing tests from user flows and requirements, choosing inputs with the techniques above, automating every test you'll run more than once, and running the whole suite in parallel on every pull request.

List every user flow and the variations that change its outcome

Go through the app feature by feature and write down each distinct thing a user comes to do, such as signing up, inviting a teammate, or exporting a report, plus the variations that change the outcome, such as an expired link or a user without permission. Leave out combinations that don't change anything, since the paths through an app have no end. That list is what the tests should cover, and what to measure test coverage against.

Write the expected result before running the test

Decide what should happen from the requirements, and write it into the test case before anyone runs it. An expected result copied from whatever the app did the first time checks nothing.

Choose inputs with the techniques, then add your best guesses

Use equivalence partitioning and boundary values for every field with a range, decision tables for rules that combine conditions, and state transitions for anything that depends on history. Then add the cases experience says break, and include invalid inputs as well as valid ones, which is called negative testing.

Have a person check each new feature, then automate its tests

A person checks a new feature first, for usability and anything a script can't judge, and then the team builds automated tests for its flows. Automated, the same tests re-check the feature on every change, long after the person has moved on to the next one.

Find elements the way a user does

Automated black-box tests should find buttons and fields by their role, label, or visible text, the way a user does, instead of by CSS classes or internal IDs that change when the code does. Playwright's role and label locators work this way, so a test keeps passing through a refactor that doesn't change what users see.

Run the whole suite in parallel on every pull request

Parallel testing runs every test at the same time, each on its own browser or device, so the suite takes about as long as its longest test. Running it on every pull request, the proposed code change a developer opens for review, catches a break before it merges, while the developer still remembers the change.

Investigate every failure

A failed black-box test can mean a real bug, a test that's out of date because the feature changed on purpose, or a flake, a test that passes and fails with no change to the code. Sort each failure into one of those, report the bugs with the steps to reproduce them, and fix the tests, so the team keeps trusting the suite.

Pair black-box tests with developers' unit tests

Developers write white-box unit tests for the code they change, and those tests catch logic errors in milliseconds, close to the change. The black-box suite checks what users actually do, so each catches what the other misses. QA Wolf's view is that unit testing is the source of product quality, and end-to-end testing is what guarantees it.

How does QA Wolf run black-box end-to-end tests?

QA Wolf's AI agents write black-box end-to-end tests for your app's user flows in open-source Playwright and Appium, run every test in parallel on every pull request, and maintain the tests as your app changes. Sign up and tell the agent "build me a test plan," and it explores your app and outlines a test for each flow it finds, so you can choose which flows get tests first. When an agent needs an answer, such as whether a change was intended, it asks you. From QA Wolf's docs and engineering posts:

  • The agent maps your app from the outside: It opens your app in a browser and explores each feature, then writes each workflow it finds as an Arrange-Act-Assert outline. The map shows where you have coverage, where it's missing, and where regressions most often appear.
  • It writes the tests as code you own: The agent writes standard Playwright tests for web apps and Appium tests for iOS, Android, Windows, and macOS apps. Your team can read, change, and version them like any other code, so the suite isn't locked into QA Wolf.
  • Every test runs at once: Each test gets its own container, with its own browser, iOS or Android device, or Windows or Mac VM, so the suite finishes in about the time of its longest test.
  • The suite runs on every pull request: PR testing runs your flows against each pull request's preview deploy, a temporary copy of your app built from that change, and reports the result on the pull request.
  • Every failure gets investigated: QA Wolf's AI sorts each failure into a product bug, an out-of-date test, or a flake, and real bugs are reported to you with a recording, logs, and the steps to reproduce them.
  • Each failed check is diagnosed on its own: The agent writes soft assertions by default, so one run reports every failed check, and failures with different causes become separate bugs.
  • The agents maintain the tests: When your product changes, they update the tests it breaks, with unlimited repairs, so the suite keeps passing.

QA Wolf's agents do this work better than general-purpose coding agents. On 1,567 evals across web, iOS, and Android apps, QA Wolf passed 93%, against 78% for Claude Code and 74% for Codex.

Drata is a perfect example. QA Wolf grew Drata's automated regression suite from about 100 tests to more than 400, and with the tests running in parallel, a full run went from 1–2 hours to 10–15 minutes. Drata went from deploying overnight to deploying several times a day.

On QA Wolf's full service, the same agents do the work and send their questions to QA Wolf's engineers instead of your team.

Start now and ask the agent to map your app and outline a test for each user flow, or talk to sales.

Frequently asked questions

  • What is black-box testing?

    Black-box testing checks what software does without looking at how its code works. The person or tool running a test gives the app inputs through its screens, API, or command line and compares the outputs with what the requirements say should happen. End-to-end tests, like the ones QA Wolf's AI agents write in Playwright and Appium, are black-box tests of whole user flows.

  • What is another name for black-box testing?

    Black-box testing is also called specification-based testing, behavioral testing, or closed-box testing. Each name means tests designed from what the software should do, without knowledge of its code.

  • Who performs black-box testing?

    QA engineers do most black-box testing, alongside developers, product managers, and the business users who run user acceptance testing, while security specialists run black-box penetration tests. QA Wolf's AI agents do it too, exploring an app through its interface, writing end-to-end tests for its user flows, and running them on every pull request.

  • What are the types of black-box testing?

    The main types of black-box testing are functional testing, non-functional testing (such as load, usability, and accessibility testing), regression testing, end-to-end testing, acceptance testing, and security testing. Its main techniques are equivalence partitioning, boundary value analysis, decision table testing, state transition testing, use case and user flow testing, pairwise testing, and error guessing.

  • When should you use black-box testing?

    Use black-box testing whenever the question is whether the software does what its users and requirements need, which covers every feature, every user flow, and every release. It's the only way to check that the parts of an app work together for a user. Pair it with white-box unit tests, which developers write to check the logic inside their code.

  • How do you do black-box testing?

    Start from the requirements or user flows, choose inputs with techniques such as equivalence partitioning and boundary value analysis, and write down the expected result for each before running the tests through the app's interface. Automate the tests you'll run again, and run the whole suite in parallel on every pull request. QA Wolf's AI agents can map your app's user flows and write and maintain the end-to-end tests for you.

  • What is black-box penetration testing?

    A black-box penetration test is a security test in which specialists try to break into an app with no inside knowledge, such as its code or credentials, the way an outside attacker would. It shows what an attacker could find from the outside, and security teams or specialist firms run it, separately from functional testing.

More from the blog

All posts