Your Training Partner
Techniques Toolbox
Left-to-right diagram. The test basis includes requirements, acceptance criteria, a decision table and a state diagram. It supplies the test cases with their inputs and their expected results. The inputs pass into a closed box that stands for the test object. The tester compares the actual outputs with the expected results. A match means the test passes. A deviation produces a defect report. Below the flow, pictograms name the techniques: partitions, boundary values, decision table, state transitions.

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.

Test basis
Requirements
Acceptance criteria
Decision table
State diagram
Test cases
Inputs
Expected results
Test object
Actual outputs
Comparison
Expected results
Actual outputs
Match: test passed
Deviation: defect report
Techniques
Partitions
Boundary values
Decision table
State transitions
The test basis supplies the inputs and the expected results. The tester compares the outputs of the test object with the expected results without looking inside.

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 describesTechniqueCoverage items
Values that the system treats the same wayEquivalence partitioningThe valid and invalid partitions
Ordered range with thresholdsBoundary value analysisThe boundary values and their neighbours
Rules that combine several conditionsDecision table testingThe feasible columns of the table
Behaviour that depends on past eventsState transition testingThe states, the valid transitions or all transitions
The table maps what a requirement describes to the black-box technique that fits it and to the coverage items that the tests must exercise.

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.

Partition x ≤ 10
Partition x > 10
8
9
10
11
12
13
Two values
Expected
Actual (faulty code)
Verdict
x = 10
true
true
pass
x = 11
false
false
pass
Three values
Expected
Actual (faulty code)
Verdict
x = 9
true
false
fail
x = 10
true
true
pass
x = 11
false
false
pass
x = 12
false
false
pass
The developer codes the requirement "x ≤ 10" as "x = 10". The tests with x = 10 and x = 11 pass. The value x = 9 exposes the defect. Only three-value analysis tests it. The example comes from the ISTQB syllabus.

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 stateShipCancel
In preparationShippedClosed
ShippedReturn open
Closed
Return open
State table of an order: four states and two events give eight cells. The three filled cells are the valid transitions. The five empty cells are the invalid transitions. All transitions coverage therefore counts eight items. Each invalid transition needs its own test case.

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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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.

Fictitious requirement REQ-12
P1 invalid: up to 0.00
TC-010.00
TC-020.01
P2 valid: 0.01 to 10'000.00 (immediate execution)
TC-0310'000.00
TC-0410'000.01
P3 valid: 10'000.01 to 100'000.00 (confirmation)
TC-05100'000.00
TC-06100'000.01
P4 invalid: from 100'000.01
Amount (CHF)
Fictitious requirement REQ-12. The axis shows the four partitions of the transfer amounts and the six boundary values. Each boundary value carries the test case that exercises it.
CaseAmount (CHF)PartitionBoundary valueExpected result
TC-010.00P1 invalid (up to 0.00)Maximum of P1Transfer rejected
TC-020.01P2 valid (0.01 to 10'000.00)Minimum of P2Transfer executed
TC-0310'000.00P2 valid (0.01 to 10'000.00)Maximum of P2Transfer executed
TC-0410'000.01P3 valid (10'000.01 to 100'000.00)Minimum of P3Confirmation requested in the app
TC-05100'000.00P3 valid (10'000.01 to 100'000.00)Maximum of P3Confirmation requested in the app
TC-06100'000.01P4 invalid (from 100'000.01)Minimum of P4Transfer rejected
Six test cases derived from requirement REQ-12. They exercise the four partitions and the six boundary values of the transfer amounts.

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

DimensionLevelRationale
PreparationMediumReview the test basis, then derive the partitions, the boundaries and the rules of each requirement.
ExecutionMediumEach manual case runs again in every cycle. Automation lowers the cost of the later cycles.
DocumentationMediumUpdate 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

Black Box Illumination
All techniques
Blue Ocean Strategy