Black-Box Testing
Black-box testing designs tests from the specified behaviour of software or a system without reference to its internal structure. The tester supplies inputs and compares the outputs with the results that the specification expects. The ISTQB also calls it specification-based testing. Its most common techniques are equivalence partitioning, boundary value analysis, decision table testing and state transition testing. The test cases stay valid when the implementation changes and the required behaviour does not.
Goal
Black-box testing derives the tests from the specified behaviour of the test object. The test object is the software, system or component that the team tests. The SWEBOK states that the test cases rest only on its input and output behaviour. According to the ISTQB Foundation Level syllabus, this testing primarily checks the behaviour of the system against its specifications.
Outside trivial cases, no team can test every combination of inputs. Black-box techniques select a small number of test cases that exercise each specified behaviour. Each technique also sets a coverage measure. The team then knows what share of the specification its tests have exercised.
The deliverable is a set of test cases. Each case carries its inputs, its expected result and the requirement it comes from. The analyst can write the cases before the code exists. Execution then produces test logs and defect reports. In user acceptance testing (UAT), these results support the go-live decision: does the solution do what the organisation asked for?
Usage
When to use it
- User acceptance testing (UAT): the users check the solution against their needs without reading the code.
- Acceptance criteria written before development: derive the test cases from them in the specification workshop.
- Combined business rules: prices, entitlements, discounts or validations that depend on several conditions.
- Fields with thresholds: amounts, ages, dates and quantities where a limit changes the processing.
- Behaviour that depends on history: the statuses of a request, an order or a contract.
- Vendor package or service: the specification and the interface are enough when the source code is out of reach.
- Technical redesign: the existing tests check that the required behaviour has not changed.
When not to use it
- No usable specification: first write the acceptance criteria or use exploratory testing.
- Code coverage required: white-box testing measures the statements and branches executed.
- Non-executable work product: check a specification or a model in a review.
Description
The principle
Black-box testing starts from the test basis, which describes the expected behaviour. It includes requirements, user stories with their acceptance criteria, use cases, decision tables and state diagrams. The tester reads neither the code nor the architecture. The expected result comes from the test basis and never from the software.
The ISTQB uses the term in two senses. As a test type, black-box testing contrasts with white-box testing. White-box testing derives the tests from the internal structure: code, architecture, work flows and data flows. As a class of techniques, black-box testing comprises the specification-based test design techniques.
The ISTQB syllabus separates black-box testing from functional testing. Functional testing concerns what the test object does. Black-box testing concerns where the tests come from. Black-box testing therefore also covers non-functional requirements. The team tests a requirement such as "The search responds in under two seconds" from the outside. Black-box testing applies at every test level: component, component integration, system, system integration and acceptance.
Choosing the technique by what the requirement describes
Each technique defines its coverage items, that is, what the tests must exercise. The team measures coverage as a percentage: the items exercised divided by the items identified. These items come from the specification, never from the code.
| What the requirement describes | Technique | Coverage items |
|---|---|---|
| Values that the system treats the same way | Equivalence partitioning | The valid and invalid partitions |
| Ordered range with thresholds | Boundary value analysis | The boundary values and their neighbours |
| Rules that combine several conditions | Decision table testing | The feasible columns of the table |
| Behaviour that depends on past events | State transition testing | The states, the valid transitions or all transitions |
The ISO/IEC/IEEE 29119-4 standard lists further specification-based techniques: the classification tree method, combinatorial test techniques, cause-effect graphing, scenario testing and requirements-based testing.
Equivalence partitioning
The technique divides the data into partitions. The test object must process all the elements of a partition the same way. The technique assumes that a test finds the same defects with any value of the partition. One test per partition then suffices. The partitions are non-empty and do not overlap.
A valid partition contains the values that the test object must process. An invalid partition contains the values that it must reject or ignore. The ISTQB notes that this dividing line varies from one team to another. The team therefore agrees on its definition before partitioning. Coverage of 100% requires at least one test for every valid and every invalid partition.
When the test object takes several parameters, each parameter has its own partitions. The simplest criterion is Each Choice coverage: the tests exercise each partition of each parameter at least once. This criterion ignores combinations. Decision tables and combinatorial test techniques handle them.
Boundary value analysis
Boundary value analysis extends equivalence partitioning. It applies only to ordered partitions. The boundary values of a partition are its minimum and its maximum. The technique targets these values because developers get them wrong more often. The typical defect shifts a boundary or omits it.
The ISTQB teaches two variants. Two-value analysis tests each boundary and its closest neighbour in the adjacent partition. Three-value analysis tests each boundary and both its neighbours. The syllabus shows why the second is more rigorous. A developer codes the requirement "x ≤ 10" as "x = 10" by mistake. Two-value analysis tests x = 10 and x = 11. Both tests pass. Three-value analysis adds x = 9 and x = 12. With x = 9 the expected result is true and the code returns false: the test exposes the defect.
Decision table testing
A decision table records business rules that combine several conditions. The rows carry the conditions and the actions. Each column is a rule: a unique combination of conditions and the actions that follow from it. A condition takes T (true), F (false), "–" (no effect on the outcome) or N/A (impossible combination). An X marks the expected action.
The coverage items are the feasible columns. The table shows the combinations that nobody had considered. It also brings out gaps and contradictions in the requirements. The number of rules grows exponentially with the number of conditions: ten binary conditions give 1'024 rules. To reduce the table, the team merges the columns where a condition has no effect. It can also select the rules to test by risk.
State transition testing
State transition testing applies when the response of the system depends on past events. The same "Cancel" event closes an order in preparation and opens a return on a shipped order. The model comes from state modelling: a state diagram or a state table. In this model, a test case is a sequence of events that produces a sequence of state changes.
| Current state | Ship | Cancel |
|---|---|---|
| In preparation | Shipped | Closed |
| Shipped | Return open | |
| Closed | ||
| Return open |
The ISTQB ranks the coverage criteria from weakest to strongest. All states coverage exercises every state. Valid transitions coverage exercises every permitted transition. It is the most widely used criterion. All transitions coverage also attempts every invalid transition. The state table shows these invalid transitions as empty cells, which the diagram does not show. Each test case attempts a single invalid transition. With two in one case, one defect can mask the other. The syllabus recommends all transitions coverage as the minimum for mission-critical or safety-critical software.
The steps
Steps 1 to 6 follow four of the ISTQB test activities: test analysis, test design, test implementation and test execution. Step 7 belongs to test monitoring and to traceability.
- Establish the test basis. The analyst gathers the test basis and records the version of each document. The analyst then checks that each requirement sets an observable result. A requirement without an expected result yields no test case. Each ambiguity goes into a defect report against the test basis.
- Derive the test conditions. A test condition is a testable aspect of the test basis, for example "transfer above the limit". The team ranks the conditions by risk: the likelihood and the impact of a failure.
- Choose a technique per requirement. Each requirement receives the technique that matches what it describes. One requirement often calls for two: REQ-12 combines partitions and boundary values.
- Identify the coverage items and write the test cases. Each case carries its preconditions, its inputs and its expected result. The team sets the target coverage as a percentage for each technique.
- Prepare the test run. The team groups the cases into test procedures and test suites. It prepares the test data and the environment. The cases to automate become scripts.
- Execute and compare. The tester runs each case and compares the actual result with the expected result. The test log records each run. The tester analyses each anomaly, then reports it in a defect report.
- Measure coverage and trace. The team reports the coverage achieved per technique. It links each requirement to its test cases, their results and the defects. A requirement without a test case becomes visible.
The analyst in acceptance testing
Acceptance testing validates the solution: it shows that the solution meets the business needs of the user and is ready for deployment. The ISTQB syllabus and the SWEBOK usually assign it to the end users, who run it alone or with the team. The syllabus names its main forms: user, operational, contractual and regulatory acceptance testing, alpha testing and beta testing. The business analyst mainly prepares user acceptance testing. As author of the requirements and the acceptance criteria, the analyst supplies the test basis and derives the test cases from it with the users.
Acceptance test-driven development (ATDD) moves this work ahead of development. The team analyses the user story and its acceptance criteria in a specification workshop. In the workshop, customers, developers and testers resolve the ambiguities. The team then bases the test cases on these criteria. According to the ISTQB, the team writes the positive cases first, then the negative cases, then the cases on non-functional characteristics. The team can design these cases with black-box techniques. Once automated, these tests become executable requirements.
The pitfalls
Testing a wrong specification. Black-box testing checks the solution against the test basis. A missing or wrong requirement produces a missing or wrong test. The analyst therefore reviews the test basis before deriving the cases from it. When the specification is vague, outdated or incomplete, white-box testing finds defects that black-box testing misses.
Believing that everything is tested. The ISTQB notes that even at 100% partition or transition coverage, black-box testing alone does not measure code coverage. White-box testing measures the statements and branches exercised. White-box testing misses the requirements that nobody implemented. Black-box testing misses the code that the specification ignores.
Forgetting the invalid partitions. Teams write the positive cases as a matter of course. Negative amounts, impossible dates and empty fields take deliberate effort. Partition coverage that omits the invalid partitions stays below 100%.
Confusing the absence of defects with success. The ISTQB makes this a testing principle. A team can test every specified requirement, fix every defect and deliver a system that does not meet the needs of its users. Black-box testing checks conformance to the specification. The users also validate the solution against their needs.
Rerunning the same tests without updating them. Tests repeated unchanged find fewer and fewer new defects. The ISTQB calls this principle "tests wear out". The team changes the data and adds cases. It keeps the suites unchanged for automated regression testing, where repetition serves a purpose.
AI considerations
A language model speeds up test design. The analyst submits a requirement to it. The model proposes the partitions, the boundary values and the expected results. It converts a business rule written in prose into a decision table and lists the combinations that the text does not handle. It translates acceptance criteria into Gherkin scenarios of the form "Given… When… Then…". It generates synthetic test data in place of production data.
The model reads the same specification as the tester. It therefore cannot see what the specification omits. It can also produce a plausible expected result that the test basis does not contain. The analyst checks each expected result against the requirement it comes from and rejects any result without a source. A specification or test data that contain personal data or trade secrets stay out of public tools. The Federal Act on Data Protection (FADP) also applies to test data drawn from production.
Examples
The requirement is fictitious: "REQ-12. An e-banking transfer from CHF 0.01 to CHF 10'000.00 executes immediately. From CHF 10'000.01 to CHF 100'000.00, it waits for a confirmation in the mobile app. The system rejects any other amount." The amount moves in steps of CHF 0.01.
| Case | Amount (CHF) | Partition | Boundary value | Expected result |
|---|---|---|---|---|
| TC-01 | 0.00 | P1 invalid (up to 0.00) | Maximum of P1 | Transfer rejected |
| TC-02 | 0.01 | P2 valid (0.01 to 10'000.00) | Minimum of P2 | Transfer executed |
| TC-03 | 10'000.00 | P2 valid (0.01 to 10'000.00) | Maximum of P2 | Transfer executed |
| TC-04 | 10'000.01 | P3 valid (10'000.01 to 100'000.00) | Minimum of P3 | Confirmation requested in the app |
| TC-05 | 100'000.00 | P3 valid (10'000.01 to 100'000.00) | Maximum of P3 | Confirmation requested in the app |
| TC-06 | 100'000.01 | P4 invalid (from 100'000.01) | Minimum of P4 | Transfer rejected |
Six cases reach 100% coverage of the partitions and of the two-value boundaries. TC-03 and TC-04 bracket the confirmation threshold. If the code sends only amounts below CHF 10'000.00 straight through, TC-03 fails: the transfer of CHF 10'000.00 waits for a confirmation instead of executing. Three-value analysis would add six amounts: -0.01, 0.02, 9'999.99, 10'000.02, 99'999.99 and 100'000.02.
Visualisations
The flow diagram shows what the tester sees: inputs, outputs and a closed box. The number line of the x values shows why three-value analysis detects a defect that two-value analysis misses. The technique table maps what a requirement describes to the technique that fits it. The state table of the order shows the invalid transitions that all transitions coverage must attempt. The amount axis and the table of test cases show the deliverable of the example.
Cost
| Dimension | Level | Rationale |
|---|---|---|
| Preparation | Medium | Review the test basis, then derive the partitions, the boundaries and the rules of each requirement. |
| Execution | Medium | Each manual case runs again in every cycle. Automation lowers the cost of the later cycles. |
| Documentation | Medium | Update the test cases, logs, defect reports and traceability whenever a requirement changes. |
Tools
A spreadsheet is enough to list the partitions, the boundary values and the test cases of a requirement. A test management tool (Xray or Zephyr in Jira, TestRail, Azure Test Plans) links the cases to the requirements, records the runs and produces the traceability matrix. To combine several parameters, a pairwise testing tool such as PICT reduces the number of cases. Cucumber runs the cases written in Gherkin. Robot Framework, Playwright and Selenium automate tests through the user interface. Postman sends requests to an API and checks the responses.
Sources
- ISTQB, Certified Tester Foundation Level (CTFL) Syllabus v4.0.1, 2024. §1.3: the impossibility of exhaustive testing, the wear-out of tests and the absence-of-defects fallacy. §1.4.1, §1.4.3 and §1.4.4: the test activities, their work products and traceability. §2.2.1 and §2.2.2: the test levels and the test types. §4.1 and §4.2.1 to §4.2.4: the definition and the black-box techniques with their coverage criteria. §4.3.3: the limit of code coverage. §4.5.3: ATDD.
- IEEE Computer Society, Guide to the Software Engineering Body of Knowledge (SWEBOK Guide) v4.0a, Software Testing. §2.1.4: acceptance testing. §3 and §3.1: the definition of the black-box techniques.
- ISO/IEC/IEEE 29119-4:2021, Software and systems engineering - Software testing - Part 4: Test techniques, ISO. §5.2: the specification-based test design techniques. §6.2: their coverage measures.

