Bookmarks
ReferenceTesting (QA)Verified

Test design

Test design is a method for choosing checks from requirements. This reference covers ISTQB concepts, equivalence partitions, boundary values, decision tables and test cases.

checked 1 Nov · next check 8 Nov · 45 min read

Sections
12
Reading
45 min
Languages
RU · UZ · EN
Written from
istqb.org

Check status of the reference

Verified 1 Nov · next check 8 Nov

The sections were compared with the release notes, the check found nothing, and all source links respond.

  1. Verified
  2. Scheduled check

What test design is and how it works

Test design is the stage after analysis in which test conditions are turned into test cases with input data and an expected result. Test design techniques systematically produce a small but sufficient set of tests.

Test design is needed almost always: exhaustive testing is impossible except in trivial cases. An “age” field accepts thousands of values, while equivalence partitions and boundary values reduce them to a few tests, each checking its own part of the rule. Black-box techniques rely on the specification, white-box techniques on the code, and experience-based techniques complement both and find defects that the others miss.

According to the CTFL, testing consists of groups of activities: planning, monitoring and control, analysis, design, implementation, execution and completion. They often run in iterations or in parallel. Analysis studies the test basis (requirements, user stories) and answers the question “what to test” by identifying test conditions. Test design answers “how to test”: it turns conditions into test cases, identifies coverage items and determines the data and environment needed. Implementation assembles test cases into procedures and suites, and execution produces results.

Planning, monitoring and control, and completion surround these steps and are not shown in the diagram.

Traceability is maintained between the basis and everything derived from it: requirement → test condition → test case → result → defect. It shows whether requirements are covered by tests, what a change to a requirement will affect and what risk remains, and it makes progress reports clear to stakeholders.

Groups of techniques

The CTFL divides techniques into three groups: black-box, white-box and experience-based. Collaboration-based approaches stand apart: their aim is not only to find a defect but to prevent it.

GroupWhat it relies onExamplesWhen to use
Black-boxspecified behaviour of the object, without looking at its internal structureequivalence partitioning, boundary value analysis, decision tables, state transition testingrequirements exist; tests do not become outdated when the implementation changes
White-boxinternal structure: code and processing logicstatement and branch testingthe code is already written and you need to know which part of it was executed
Experience-basedthe knowledge and experience of the testererror guessing, exploratory testing, checklist-based testingin addition to the first two: they find what those miss
Collaboration-basedjoint work of the customer, developers and testerscollaborative user story writing, acceptance criteria, ATDDbefore development, so that the defect never appears

What you need to know first

  • The terms “error”, “defect”, “failure”, “test case” and “coverage” are covered in the “Core testing concepts” section of this reference
  • For white-box techniques, the ability to read code: conditions, loops and functions (the Python reference)

How to turn test cases into automated tests is described in the pytest and Playwright references, and what to check in an HTTP API in the “API testing” reference.

Section sources

the section is written from these pages

Checklist

Go through this list once the test cases are written: before review and before the first run. Each item is a verifiable action, explained in the working sections of the reference.

Test basis

  • Read every requirement and note questions about unclear points: whether “up to 60” is inclusive, what to do with an empty field
  • Identify the test conditions for each requirement and link them: “requirement → condition”
  • Prioritise the conditions by risk: whatever is most costly to break is checked first
  • Define the test oracle: where the expected result comes from — the requirement, a reference system or an expert

Techniques

  • Split every input and output into equivalence partitions, including invalid ones
  • For every ordered partition — numbers, dates, string lengths — list the boundary values and their neighbours
  • Reduce combinations of conditions to a decision table and check that it has no missing or contradictory rules
  • For processes and life cycles, draw a state diagram and a state table and list the invalid transitions
  • Choose a technique by the kind of requirement and the risk, not by habit

Test cases

  • Give each test case a single purpose and a name that states it
  • Write the expected result precisely: a number, the text of a message, the state of the data — not “works correctly”
  • Specify preconditions and test data so that someone else can run the test without questions
  • Check one invalid value per test case and keep the other inputs valid
  • Remove duplicates: two test cases should not check the same thing

Coverage

  • Calculate coverage for each technique: partitions, boundary values, valid decision table columns, transitions
  • Make sure negative tests exist: invalid partitions, values beyond the boundaries, invalid transitions
  • For critical functions, achieve coverage of all transitions, including invalid ones

Experience

  • Complement formal tests with attacks on typical mistakes: input, output, logic, calculations, interfaces, data
  • Before an exploratory session, write a test charter: the goal, resources and what you are looking for — and limit the time
  • Phrase the items of your own checklists as questions answered “yes”, “no” or “not applicable”
  • Remove from a checklist whatever is checked automatically, and items that are too general

Section sources

the section is written from these pages

Core testing concepts

Testing is a set of activities that find defects and evaluate the quality of a product, not just running a program. A human error produces a defect, a flaw in the product, and a defect can cause a failure, incorrect behaviour of the system, when it is executed.

Error, defect, failure

An error has the synonym mistake; a defect has fault and bug. People make errors because of haste, the complexity of the task, tiredness or lack of knowledge. A defect can be in the requirements, a test script, the code or a build file, and a defect in an early work product often gives rise to defects in later ones. Not every defect leads to a failure, and a failure can also be caused by the environment, for example radiation that corrupts firmware.

ConceptWhat it isExample with an “age” field
Errora human action that leads to an incorrect resultthe analyst wrote “over 18” meaning “18 or older”
Defecta flaw in the requirements, code or another work productthe requirement says “over 18”, and the code checks age > 18 accordingly
Failurethe system does something it should not, or fails to do what it shouldan 18-year-old user cannot register
Root causethe underlying cause of the problem; removing it prevents similar defects from recurringthe requirements have no examples at the boundary

Test objectives and debugging

Typical test objectives according to the CTFL:

  • Evaluate work products: requirements, user stories, designs and code
  • Cause failures and find defects
  • Ensure the required coverage of the test object
  • Reduce the risk of inadequate quality
  • Verify that requirements are met, including contractual and regulatory ones (verification), and that user needs are satisfied (validation)
  • Give stakeholders information for decisions and confidence in the quality

Testing and debugging are different activities. Dynamic testing causes failures, while static testing — reviews and static analysis — finds defects directly in the product. Debugging finds the cause of a failure and removes it: it reproduces the failure, finds the defect and fixes it. Confirmation testing then checks that the problem is solved, and regression testing checks that the fix has not broken other parts.

Seven testing principles

PrincipleWhat it means in practice
Testing shows the presence of defects, not their absenceno test run proves that there are no defects; it only lowers the probability that some remain
Exhaustive testing is impossibleinstead of “test everything”, use test design techniques, test case prioritisation and risk-based testing
Early testing saves time and moneya defect found in the requirements does not give rise to new defects in the design and code
Defects cluster togethera few components contain most of the defects; such clusters are a reason to test them more deeply
Tests wear outthe same tests stop finding new defects over time: vary tests and data; in automated regression, repetition is useful
Testing is context dependentthere is no single approach for all cases
The absence-of-defects fallacya system with no defects found may still fail to solve users’ problems: besides verification, validation is needed

Testware

Testware is everything created during testing. These are the terms that the other sections of the reference build on:

TermWhat it is
Test objectwhat is being tested: a component, a system, a document
Test basiswhat tests are designed from: requirements, user stories, designs
Test conditiona testable aspect identified during analysis: “the form rejects an age under 18”
Coverage itemwhat is counted when measuring coverage: a partition, a boundary value, a table column, a transition
Test casethe preconditions, input data, steps and expected result of a single check
Test proceduretest cases arranged in order of execution
Test suiteprocedures and scripts that are run together
Coveragethe share of coverage items exercised by tests, as a percentage

Test levels and test types

A test level is a group of activities organised together for one stage of development, from an individual component to the whole system. The CTFL describes five levels:

LevelWhat it checks
Component (unit)a component in isolation; usually performed by developers
Component integrationinterfaces and interaction between components
Systemthe behaviour of the whole system: end-to-end tasks and non-functional characteristics
System integrationinterfaces with other systems and external services
Acceptancereadiness for deployment and fit with user needs: user, operational, contractual, regulatory, alpha and beta testing

A test type relates to quality characteristics and applies at any level. The CTFL names four types. Functional testing checks what the system does. Non-functional testing checks how well it does it: performance, compatibility, usability, reliability, security, maintainability, portability and safety according to ISO/IEC 25010. Black-box testing derives tests from the specification, and white-box testing from the internal structure.

After a change, two more checks are added. Confirmation testing makes sure that the defect has been fixed. Regression testing makes sure that the change has broken nothing elsewhere; its suites are run many times, so they are the first candidates for automation.

Section sources

the section is written from these pages

Equivalence partitioning

An equivalence partition is a group of values that the system should handle in the same way. If a test with one value from a partition finds a defect, a test with any other value would have found it too, so one test per partition is enough.

Apply the technique to any data element: inputs and outputs, settings, internal values, time, interface parameters. Partitions can be continuous or discrete, ordered or unordered, finite or infinite. There are two mandatory conditions: partitions do not overlap, and none is empty.

A partition of valid values is called a valid partition, and one of invalid values an invalid partition. Teams decide differently what counts as valid: for example, whatever the system must process, or whatever the specification describes processing for. Invalid means whatever the system must reject or ignore.

How to identify partitions

  1. List the inputs and outputs under test and, for each, the processing rule from the requirement.
  2. For each input, find the valid partitions: ranges or sets of values handled in the same way.
  3. Find the invalid partitions: values out of range, of another type or in the wrong format.
  4. Take one value from each partition. The edges of partitions are checked by a separate technique, boundary value analysis.
  5. Write the test cases so that every partition, including invalid ones, is exercised at least once.

Example: age from 18 to 60

Requirement: “Registration is available to people aged 18 to 60 inclusive; age is entered as a whole number. Outside the range, show the message “Age must be between 18 and 60”; for a non-number, “Enter your age as a number”.” The partitions and values for the tests:

PartitionValidValueExpected result
under 18no10message “Age must be between 18 and 60”
18–60yes35account created
over 60no75message “Age must be between 18 and 60”
not a numbernoabcmessage “Enter your age as a number”

Four partitions, four tests, and each value represents its whole partition:

Any value inside a partition will do: the technique assumes the system will handle it the same way as the others.

Coverage is calculated as follows: the number of partitions exercised by at least one test, divided by the number of all identified partitions, including invalid ones. The four tests from the table give 4 of 4, that is 100%. If you check only 35 and 75, coverage is 2 of 4, or 50%.

The requirement does not say what to display for an empty field or for a fractional number such as 25.5. That is no reason to choose the expected result yourself: ask the analyst, and add partitions when the answer arrives.

Several inputs: Each Choice

When there are several inputs, each has its own set of partitions, and one test covers one partition from each set. The simplest criterion is Each Choice: every partition of every set is exercised at least once. It does not take combinations of partitions into account. An example for age and payment method, card or cash:

TestAgePayment
135 (18–60)card
210 (under 18)cash
375 (over 60)card
4abc (not a number)cash

Four tests are enough for all four age partitions and both payment methods, and each test contains no more than one invalid value. Combinations of partitions are checked with decision tables or combinatorial testing.

In depth: domain testing

The CTAL-TA generalises partitions and boundaries into domain testing. There a partition is defined by an expression of several conditions over several variables, for example “height > 1.29 m AND weight / height² ≥ 30”. The coverage items are the ON and OFF points at each boundary and, in a stricter criterion, also IN and OUT. This is needed when validity depends on several fields at once.

Section sources

the section is written from these pages

Boundary values

Boundary value analysis (BVA) tests the minimum and maximum value of each equivalence partition and their neighbours. Developers make most of their mistakes at the edges: they shift a boundary by one step, writing age > 18 instead of age >= 18, or forget it altogether.

The technique applies only to ordered partitions: numbers, dates, times, string lengths, amounts. In such a partition, no value from another partition lies between any two of its values. Unordered partitions, such as countries or payment methods, have no boundaries, and equivalence partitioning is enough for them.

Two or three values per boundary

CTFL describes two variants. In 2-value BVA, each boundary value has two coverage items: the value itself and its nearest neighbour in the adjacent partition. In 3-value BVA, the items are the value and both of its neighbours, so some of the tested values lie inside a partition rather than on its edge.

3-value BVA is stricter: it finds defects that 2-value BVA misses. A CTFL example: the condition x <= 10 was mistakenly written as x == 10. The 2-value BVA values 10 and 11 give the correct result even with the defect, but the neighbour 9 from 3-value BVA exposes it.

Example: age from 18 to 60

The partitions are “under 18”, “18–60” and “over 60”, and the step is 1 year. The boundary values are the edges of the partitions on both sides of each boundary: 17 and 18, 60 and 61. 2-value BVA tests these; 3-value BVA adds the outer neighbour of each: 16, 19, 59 and 62.

Red cells are invalid partitions, green cells are the valid one, and dashed lines mark the boundaries between partitions.
ValuePartitionAnalysisExpected result
16under 183-valuerejected
17under 18bothrejected
1818–60bothaccount created
1918–603-valueaccount created
5918–603-valueaccount created
6018–60bothaccount created
61over 60bothrejected
62over 603-valuerejected

“Rejected” means the message “Age must be between 18 and 60”. In total, 2-value BVA gives 4 tests and 3-value BVA gives 8. The requirement does not define the outer edges of the “under 18” and “over 60” partitions. If the system limits them, for example by refusing a negative age, that is another boundary with its own tests.

Step size: choosing the neighbour

The neighbour is the nearest value at the precision with which the system stores the data. Take the step from the requirement or from the field type:

DataStepBoundary and neighbour
Integer: age from 18117 and 18
Amount to 0.01 precision: from 1,0000.01999.99 and 1,000.00
Date: applications from 1 November 20261 day31 October and 1 November
Password length: from 8 characters1 character7 and 8 characters
Time to the second: up to and including 18:00:001 s18:00:00 and 18:00:01

Boundary value coverage

Coverage is the proportion of coverage items that have been tested: in 2-value BVA these are the boundary values, in 3-value BVA the boundary values and their neighbours. If the example tests only 17, 18 and 60, 2-value coverage is 3 out of 4, or 75%.

The second common mistake is to test only the valid boundaries, 18 and 60: that will never find the defect “the system accepts 61”. The table of values can become a single parametrised automated test: see the pytest reference, section “Parametrisation”.

Section sources

the section is written from these pages

Decision tables

A decision table shows which actions the system performs for each combination of conditions. It suits business rules such as discounts, tariffs and permissions: the table enumerates every combination and exposes the ones the requirements forgot.

Conditions and actions are the rows of the table, and each column is a rule: a unique combination of condition values and the actions it triggers. CTFL notation: T means the condition is met, F means it is not, “–” means the value does not affect the outcome, and N/A means the combination is infeasible. For actions, X means the action is performed and blank means it is not. If a condition takes more than two values, such as ranges or equivalence partitions, the table is called extended-entry.

How to build a table

  1. List the conditions and actions from the requirement.
  2. Build the full table, with one rule for each combination of condition values. The number of rules is the product of the numbers of values of the conditions; for n Boolean conditions it is 2 to the power of n.
  3. For each rule, mark which actions are performed.
  4. Remove infeasible combinations of conditions (N/A).
  5. Merge rules that give the same actions, differ in one condition and together cover all its values: the value of that condition is replaced with “–”.
  6. Write one test case for each remaining rule.

Example: discount and delivery

An online shop’s requirement: “Loyalty card holders get a 10% discount on orders of 1,000 or more. Delivery is free for orders of 1,000 or more and with a coupon.” Three Boolean conditions give 2 × 2 × 2 = 8 rules. To keep the table readable on a phone, the rules are rows and the condition values are written in a single column:

RuleCard, total of 1,000+, coupon10% discountFree delivery
1T T TXX
2T T FXX
3T F TX
4T F F
5F T TX
6F T FX
7F F TX
8F F F

Rules 1 and 2 differ only in the coupon and give the same actions: the coupon does not matter here, so the two rules become “T T –”. Rules 5 and 6, 3 and 7, and 4 and 8 merge in the same way. That leaves 4 rules instead of 8:

RuleCard, total of 1,000+, coupon10% discountFree delivery
1 and 2T T –XX
5 and 6F T –X
3 and 7– F TX
4 and 8– F F

You need one test case per rule. The tester chooses a concrete value in place of “–”: for “T T –” it could be a card, a total of 1,500 and no coupon. The expected result is a 10% discount and free delivery. If the risk is high, don’t merge the table, and test every feasible rule of the full table.

How to review a table

Review the table against the CTAL-TA criteria, preferably together with the analyst. It must be consistent: if two rules match one combination, their actions are the same. It contains no infeasible rules and no missing combinations, and the rules describe the intended behaviour. Ideally the rules also don’t overlap: each combination of conditions matches at most one rule.

Check a merged table with a checksum. A rule without “–” is worth 1, and each “–” on a Boolean condition doubles its value. In the example every rule has one “–”: 2 + 2 + 2 + 2 = 8, the same as the full table. A smaller sum means a rule has been lost; a larger one means rules overlap or there are extra rules. Equal sums don’t prove that the tables are equivalent.

Coverage and table size

A coverage item is a feasible rule, and coverage is the proportion of rules exercised by tests. The number of rules grows exponentially: 10 Boolean conditions give 1,024 rules. In that case, use a merged table or select rules by risk. Calculate coverage for the table the tests were designed from: if you test 3 rules of the example’s merged table, coverage is 3 out of 4, or 75%.

A common mistake: the forgotten combination

Requirements describe rules one at a time, and combinations are left unanswered. In the example it is unclear whether the coupon is used up in rule 1, where delivery is already free because of the total. The full table forces you to fill in every rule, so the question comes up before testing rather than with a customer.

Section sources

the section is written from these pages

State transitions

State transition testing checks a system whose response to an event depends on its current state, such as an order, an account or a document. The model is a state diagram or a state table, and a test is a sequence of events that takes the system through transitions.

A state diagram shows the states and the valid transitions between them. A transition is triggered by an event, may be refined by a guard condition, and may cause an action. A transition label is written as “event [condition] / action”, leaving out whatever is not needed. In UML notation, such a model is called a state machine.

Take an online shop order. A new order is paid for or cancelled, a paid order is shipped or cancelled, and a shipped order is delivered. A shipped order cannot be cancelled: that is an invalid transition, and the system must reject it.

The dashed line is an invalid transition: such checks are needed to cover all transitions.

State table

A state table is equivalent to the diagram: rows are states, columns are events, and each cell holds the new state and the action. An empty cell is an invalid transition, which is why the table is what makes them visible. The same order model in compact form:

StateValid eventsInvalid events
Createdpayment → Paid; cancellation → Cancelledshipment, delivery
Paidshipment → Shipped; cancellation → Cancelledpayment, delivery
Shippeddelivery → Deliveredpayment, shipment, cancellation
Delivered—all four
Cancelled—all four

The model has 5 valid transitions and 15 invalid ones: of the table’s 20 cells, 5 are filled.

Coverage criteria

A test case is a sequence of events, and one test usually passes through several transitions. CTFL describes three coverage criteria:

CriterionCoverage itemsTests for the order
All states5 states2
Valid transitions (0-switch)5 valid transitions3
All transitions5 valid and 15 invalid transitions15

All-states coverage is the weakest. Valid-transitions coverage is the most widely used; when complete, it also guarantees all-states coverage. All-transitions coverage guarantees both and, according to CTFL, should be the minimum for mission-critical and safety-critical software. Test one invalid transition per test, otherwise one defect can mask another.

Three tests for the valid transitions:

  1. “payment, shipment, delivery”: Created → Paid → Shipped → Delivered.
  2. “cancellation”: Created → Cancelled.
  3. “payment, cancellation”: Created → Paid → Cancelled.

To cover all transitions, add attempts at invalid events, one per test. For example, “payment, shipment, cancellation”: the system must reject the cancellation, and the order stays in the Shipped state.

Recipe: a guard condition on a transition

An account is locked after three wrong passwords in a row, and a correct password resets the counter. You don’t need a state per counter value: two transitions with a guard are enough. “Wrong password [failures < 2] / increment counter” leaves the account in the Active state, while “wrong password [failures = 2] / lock” moves it to Locked. The tests: three wrong passwords in a row lock the account; two wrong passwords followed by a correct one log the user in and reset the counter; a correct password in the Locked state is refused. The guard is a boundary: the second failure doesn’t lock yet, the third does.

In depth: N-switch and round-trip

CTAL-TA adds two criteria. N-switch covers sequences of N + 1 consecutive valid transitions: 0-switch is the valid transitions, and 1-switch is the pairs of an incoming and an outgoing transition at a state. The order model has three 1-switch sequences: “payment, shipment”, “payment, cancellation” and “shipment, delivery”. In practice, 0-switch and 1-switch are usually enough, and 2-switch and above are used only when the risk is high, because the number of sequences can grow exponentially with N. Round-trip covers cycles that start and end in the same state; the order has no cycles.

Section sources

the section is written from these pages

Experience-based techniques

Experience-based techniques draw on the tester’s knowledge of where software usually breaks: error guessing, exploratory testing and checklist-based testing. They find defects that formal techniques miss, and they complement those techniques rather than replace them.

The results of these techniques depend on the tester’s skills. Exploratory testing is especially useful when specifications are scarce or poor and when time is short.

Error guessing

Error guessing predicts errors, defects and failures from the tester’s knowledge. The tester considers how the application has worked before, what mistakes developers typically make and what failures similar applications have had. CTFL groups the typical problems like this:

AreaTypical problemsAttack on an “age” field
Inputa valid value is rejected, a parameter is wrong or missing18 with a trailing space; an empty field
Outputwrong format, wrong resultthe profile shows the wrong age
Logica missing case, a wrong operator> instead of >= at the boundary of 18
Calculationsa wrong operand, a wrong formulaage calculated from a birth date of 29 February
Interfacesmismatched parameters, incompatible typesthe API receives the age as the string "35"
Datawrong initialisation, wrong typethe field defaults to 0

Fault attacks are a way of applying error guessing: build or obtain a list of possible errors, defects and failures, and design tests that provoke them. Extend the list from experience, from defect data and from general knowledge of why software fails.

Exploratory testing

In exploratory testing, tests are designed, executed and evaluated at the same time, while the tester learns about the test object. It is often run as session-based testing: the work is limited by a time box, and a test charter sets the goal. After the session, the tester reviews the results with stakeholders in a debriefing. Steps and findings are recorded on a session sheet.

Exploration is more effective in the hands of an experienced tester who knows the domain. Formal techniques, such as equivalence partitioning, can also be used within a session.

Session charter

The charter sets the mission of the session: its scope, goals and constraints. CTAL-TA gives a short mission format: “Explore [target] with [resources] to discover [information]”. Add to the charter the duration and the tester, the boundaries of the scope, preconditions, environment details, known defects and risks.

FieldExample: a registration form
MissionExplore the registration form with invalid and boundary data to discover input validation errors and unclear messages
Duration60 minutes, one tester
Scopethe “Name”, “Email”, “Age” and “Password” fields and the “Register” button; login and password recovery are out of scope
Resourcesa list of input attacks, two browsers, addresses such as test1@example.com
What to recordquestions, observations, test ideas and defects, on the session sheet
After the sessiona debriefing with the analyst: what was found and what remains untested

Checklist-based testing

In checklist-based testing, the tester designs and runs tests that cover the items on a list. The items come from experience, from knowledge of what matters to users and from knowledge of why software fails. Leave out anything that is checked automatically, anything better suited to entry and exit criteria, and items that are too general.

Phrase each item as a question that can be answered “yes”, “no” or “not applicable”, and check it separately and directly. Old items lose their value over time, because developers stop making the same mistakes. So update the checklist based on defect analysis, and don’t let it grow too long. An example for a registration form:

  • Is it clear which fields are required?
  • Is an email address without “@” rejected with a clear message?
  • Is the entered data kept after a validation error?
  • Does the “Age” field reject a fractional number?
  • Can the form be filled in and submitted using only the keyboard?

Section sources

the section is written from these pages

White-box techniques and code coverage

White-box techniques derive tests from the structure of the code. Statement coverage is the share of statements executed; branch coverage is the share of control-flow transitions taken. 100% branch coverage guarantees 100% statement coverage, but not the other way round.

A branch is a transfer of control between two nodes of the control flow graph. It can be unconditional (moving to the next line) or conditional: the true or false outcome of an if, a match case, leaving a loop or starting the next iteration. Coverage is the number of items executed divided by the total number: executable statements or branches.

Example: every statement, but not every branch

pythonshop.py
def delivery_cost(total):    cost = 300    if total >= 1000:        cost = 0    return cost
pythontest_shop.py
from shop import delivery_cost  def test_free_delivery():    assert delivery_cost(1500) == 0

The test with total = 1500 executes every line of the function, so statement coverage is 100%. But the condition was never false, and the jump from if straight to return was never taken. For 100% branch coverage you need a second test, for example with total = 500.

The numbers are line numbers in shop.py; coverage.py reports the 3->5 jump in the Missing column.

Measuring in Python: coverage.py

By default coverage.py measures statement coverage; with the --branch flag it measures branches too. Run the tests under it and print a report with the missed lines and jumps:

bashin the project directory
python -m pip install coverage pytest# run the tests, measuring branchescoverage run --branch -m pytestcoverage report -m
textexample output
Name           Stmts   Miss Branch BrPart  Cover   Missing----------------------------------------------------------shop.py            5      0      2      1    86%   3->5test_shop.py       3      0      0      0   100%----------------------------------------------------------TOTAL              8      0      2      1    90%

The Branch column is the number of possible jumps (an if has two), and BrPart is the number of lines where not all of them were taken. Missing lists what was not executed: 3->5 means the jump from line 3 to line 5 never happened. Cover is computed by coverage.py from lines and jumps together: (5 + 1) / (5 + 2) ≈ 86%. Without --branch, the same test would show 100%.

pythonappend to test_shop.py
def test_paid_delivery():    assert delivery_cost(500) == 300

With this test the report shows 100% and an empty Missing. The coverage html command builds an HTML report in which lines with missed branches are highlighted in yellow. The --fail-under=100 flag of coverage report makes the command exit with code 2 if coverage is lower, which is how a threshold is enforced in CI. The pytest-cov plugin is described in the pytest reference, in the section “Plugins and hooks”.

Stricter than branches: decisions and conditions

CTAL-TTA describes stricter criteria. Decision coverage requires every outcome of every decision and is usually achieved by the same tests as branch coverage. MC/DC (modified condition/decision coverage) looks at what a decision is made of: each atomic condition must, on its own, change the outcome.

CriterionWhat must be executedWhen it is used
Statementsevery executable statementthe minimum for any code
Branches and decisionsevery outcome of every decisionimportant and critical code
MC/DCeach atomic condition independently changes the outcome of the decisionaviation, automotive, systems where a failure is catastrophic

An MC/DC example for card and total >= 1000. There are two conditions, and N + 1 = 3 tests are usually enough: (T, T) gives true, (F, T) and (T, F) give false. Each of the last two differs from (T, T) in one condition and changes the outcome. Short-circuit evaluation complicates MC/DC: if card is false, the second part of the condition is not evaluated. Stricter still is multiple condition coverage, which covers all combinations of conditions.

What coverage will not show

  • Missing requirements: if the code does not implement a requirement, white-box tests will not notice
  • Data-dependent defects: division by zero shows up only when the denominator is zero
  • Path-specific defects: 100% branch coverage does not mean every combination of branches has been executed
  • Correctness of expected results: they come from the requirements, not from the code

100% coverage does not mean the test suite is complete; it means the technique no longer suggests useful tests. The value of white-box testing lies elsewhere: it takes the whole implementation into account, even when the specification is vague, and gives an objective measure of code coverage that black-box tests lack.

Section sources

the section is written from these pages

Test cases and defect reports

A test case describes a single check: preconditions, input data, steps and an expected result. A good test case can be understood and executed by someone who did not write it. A defect report is its counterpart: it describes a failure so that a developer can reproduce it without asking questions.

High-level and low-level

A high-level test case (also called logical) names the conditions being checked without concrete values: “registration with an age above the permitted maximum is rejected”. A low-level (concrete) test case contains specific preconditions, data, expected result and postconditions. For example: “age 61 → the message ‘Age must be between 18 and 60’, no account created”.

High-level test cases are usually written first: they show that all conditions are covered. One high-level test case becomes one or several low-level ones, often at implementation time, when the data is known. Many test cases are mixed, concrete in one respect and abstract in another: a compromise between ease of maintenance and clarity.

What a test case consists of

FieldWhat to writeExample
Identifierunique, to link to the requirement and defectsTC-REG-012
Titlethe goal in one phraseRegistration rejects age 61
Requirementthe test basis item being checkedREQ-7: age from 18 to 60 inclusive
Prioritybased on riskhigh
Preconditionsthe state of the system before the startthe registration form is open; the email test12@example.com is not registered
Test dataconcrete valuesage 61, other fields valid
Stepsactions in order, one per step1. Fill in the fields. 2. Click “Register”
Expected resultexactly what should happenthe message “Age must be between 18 and 60”
Postconditionswhat to check or restore afterwardsthe account test12@example.com has not been created

Quality criteria

CTAL-TA names nine quality criteria for a test case:

CriterionWhat it means
Correctnessthe test case checks its test condition accurately
Feasibilityit can be executed
Necessityit has a clear purpose, visible from the title; there are no duplicates
Understandabilitysomeone other than the author can understand and execute it; a complex one is simplified or split
Traceabilityit is linked to test conditions, requirements and risks
Consistencylanguage, format and structure are the same across the whole set
Precisionone interpretation only, without words such as “suitable”, “if necessary”, “several”
Completenessall the necessary fields, test data and a clear expected result are present
Concisenessa small test case is better than a large one: the cause of a failure is easier to find, and a failure does not block other tests

Expected result and the test oracle

A test oracle is the source of the expected result. Ideally it is the test basis, a textual or formal specification, but human experience can also serve as an oracle. If the oracle is too expensive or does not exist, that is the test oracle problem. It is caused by complex data, nondeterminism (for example in AI-based systems), probabilistic behaviour, and incomplete or ambiguous requirements. Known solutions:

  • Pseudo-oracle: an independent system with the same specification, such as an old version or a simplified implementation
  • Model-based testing: expected results are derived from the model
  • Property-based testing: checking the relationship between input and result
  • Metamorphic testing: new tests are derived from an original test using a known relationship between inputs and results
  • Human oracle: an expert decides whether the result is correct; this is expensive but appropriate in exploratory testing

Test data

Test data is chosen during test design. The main decisions about it, according to CTAL-TA:

  • Similarity to production: real data is plausible but monotonous; synthetic data is controllable but may miss defects that only appear with real data
  • Confidentiality: personal data is pseudonymised or anonymised, and data protection laws are observed
  • Coverage: the data matches the technique, including invalid values for negative tests
  • Maintainability: do not hard-code data into the steps of a low-level test case; separate test logic from data
  • Dependencies and time: related data is created step by step, and outdated dates change the behaviour of the system

Defect report

A defect report gives the developer everything needed to fix the problem, helps track product quality and suggests how to improve the process. Not every anomaly turns out to be a defect: it may be a false positive or a change request, which is decided when the report is triaged. A report on dynamic testing contains, according to CTFL:

FieldWhat to writeExample
Identifiera unique numberBUG-345
Titlethe gist of the failureRegistration accepts age 61
Date and authorwhen it was noticed, by whom and in what role31 October 2026, tester
Test object and environmentversion and test bedbuild 2.4.1, test environment, Firefox
Contexttest case, technique, dataTC-REG-012, boundary value analysis
Description and stepshow to reproduce; logs, screenshots1. Open the form. 2. Enter age 61, everything else valid. 3. Click “Register”
Expected and actual resultwhat should happen and what doesexpected the message “Age must be between 18 and 60”; an account was created
Severityhow much harm the failure doeshigh: a registration rule is violated
Priorityhow urgently it should be fixedhigh
Status and linksthe state of the report and related documentsopen; TC-REG-012, REQ-7

Severity and priority are different fields: for example, a serious defect in a rarely used feature may be fixed later, while a minor one on the home page is fixed at once. Typical statuses: open, deferred, duplicate, waiting to be fixed, awaiting confirmation testing, reopened, closed, rejected. Defect tracking tools often fill in the identifier, date, author and initial status automatically.

Section sources

the section is written from these pages

Common mistakes in approach

Test design becomes a formality when tests check only the happy path, do not define the correct result or stay unchanged for years. The tests are written and pass, yet defects reach users.

Only positive checks

The tests follow the happy path, and the system looks ready. Error-handling defects, such as invalid values being accepted and forbidden actions being allowed, reach users.

For every input, design invalid partitions and values beyond the boundaries; for every state, invalid events. According to CTFL, covering all transitions, including attempted invalid ones, is the minimum for safety-critical software. Example: for an order you checked “payment, dispatch, delivery” but not that a dispatched order cannot be cancelled.

The expected result “works correctly”

The outcome of such a test depends on who runs it: everyone understands “correctly” in their own way, and false positives and false negatives appear.

Write the result so that there is only one interpretation: a number, the text of a message, the state of the data. Bad: “The form works correctly”. Good: “The message ‘Age must be between 18 and 60’ appears, no account is created”. CTAL-TA explicitly names precision as a quality criterion and advises avoiding words such as “suitable”, “if necessary”, “several”.

Several invalid values in one test

The form is rejected and the test passes, but it is unknown which check fired. One defect masks another (defect masking): a broken age check goes unnoticed while the form is rejected because of an invalid email.

Use one invalid value per test, with all the others valid. This is how CTFL advises testing invalid transitions, and the same rule works for invalid partitions. Example: not “age 75 and an email without @” in one test, but two tests, one for each value.

One technique for everything

Each technique finds its own defects. Partitions and boundaries alone will miss an error in a combination of conditions; decision tables alone will miss a shifted boundary.

CTAL-TA advises choosing a technique by the test objective, product risks, test basis, the tester’s knowledge, the development model, contractual and regulatory requirements and project constraints. A hint based on the kind of requirement:

In the requirementTechnique
Ranges of numbers, dates, lengths; calculationsequivalence partitions and boundary values
Combinations of conditions, business rulesdecision table
A process, the life cycle of an objectstate transitions
Few requirements, low risk, tight deadlinesexperience-based techniques
The expected result is hard to obtainmetamorphic testing or experience-based techniques

Techniques are combined: for example, conditions on state transitions are checked with boundary value analysis.

Tests with no link to requirements

A requirement changes and nobody knows which tests to update, and there is no answer to the question “is this requirement covered?”.

Link every test case to test conditions, requirements and risks; this is the traceability criterion in CTAL-TA. Example: in test case TC-REG-012 the “Requirement” field is REQ-7. If the age range changes, filtering by REQ-7 immediately shows every test that must be updated.

Everything in any order, with no priorities

Time runs out before the tests do, and the critical things stay unchecked while the trivia have been checked.

Order execution by one of the CTFL strategies:

  • Risk-based: tests for the most important risks first
  • Coverage-based: tests with the greatest coverage first
  • Requirements-based: tests for the most important requirements first

Take dependencies into account: if an important test depends on a less important one, the latter runs first. Example: the payment test needs an account, so registration is checked earlier even though its priority is lower.

Tests stay unchanged for years

Tests wear out: repeated many times, they find new defects less and less well. The suite is green, yet defects arrive in new features.

Change tests and test data, and add new tests for areas that have not been checked. Repetition is useful where it is needed, in automated regression. Example: after every defect found by users, add a test that would have caught it and review the neighbouring ones.

Test design after the code is finished

Questions about the requirements surface when the code has already been written, and fixing them costs more: a defect in a requirement has time to spawn defects in the design and the code.

Start analysis and test design together with the requirements: early testing saves time and money. Example: the question “is 60 inclusive?” costs a minute in a requirements review, but after release it costs a fix, retesting and possibly a data correction.

Section sources

the section is written from these pages

Standards and their status

The terms and techniques in this reference follow the ISTQB syllabi, based on Certified Tester Foundation Level (CTFL) v4.0.1 of 15 September 2024. The test analyst techniques come from Advanced Level Test Analyst (CTAL-TA) v4.0 of 2 May 2025. White-box testing comes from Technical Test Analyst (CTAL-TTA) v4.0.

ISTQB (International Software Testing Qualifications Board) issues certification syllabi for testers and publishes them on istqb.org together with sample exams. The CTFL syllabus sets the terms and concepts used in testing worldwide, and the CTFL certificate is a prerequisite for the other ISTQB certificates that require the Foundation level.

DocumentWhat it definesStatusReplaced or supplemented by
CTFL v4.0.1fundamentals: process, levels and types, black-box and white-box, experience-based and collaboration-based techniques, defect managementcurrent, released 15 September 2024a corrected edition (errata) of CTFL v4.0; v4.0 was a major update assembled from CTFL v3.1.1 and the Agile Tester 2014 syllabus
CTAL-TA v4.0test analyst techniques: data-based, behaviour-based, rule-based and experience-based; test cases, oracles, test datacurrent, released 2 May 2025replaced CTAL-TA v3.1.2
CTAL-TTA v4.0white-box techniques: statements, decisions, MC/DC, all condition combinations; API testingcurrent, released 30 June 2021replaced the 2019 edition
ISTQB Glossaryterms from all the syllabimaintained on istqb.orgthe wording of CTFL v4.0.1 is aligned with it

What changed in the latest editions

  • CTFL v4.0: integration testing is split into two levels, component integration testing and system integration testing
  • CTFL v4.0: decision coverage is replaced by branch coverage, since branches are more widely used in practice and different standards define a “decision” differently
  • CTFL v4.0: use case testing is removed from Foundation and remains in CTAL-TA
  • CTFL v4.0: more attention to collaboration-based approaches such as user stories, acceptance criteria and ATDD; the test pyramid, the testing quadrants and effort estimation techniques are added
  • CTFL v4.0.1: wording is aligned with the glossary, invalid equivalence partitions must be tested separately, and usability and portability have new names from ISO/IEC 25010:2023
  • CTAL-TA v4.0: black-box techniques are divided into data-based, behaviour-based and rule-based
  • CTAL-TA v4.0: partitions and boundaries are generalised into domain testing, use cases into scenario testing, and pairwise testing into combinatorial testing
  • CTAL-TA v4.0, new topics: test case quality criteria, test oracles and data, random, CRUD, metamorphic and crowd testing, test design automation

Outdated documents that are still cited

Courses, books and question banks based on CTFL v3.1.1 and earlier versions are still around. They have a single level of integration testing, decision coverage instead of branch coverage, and use case testing at the Foundation level. The CTAL-TA v3.1 syllabus is being withdrawn: for exams in English it expired on 16 May 2026, and in other languages it expires on 16 November 2026.

Detailed descriptions of the techniques with examples are given in the international standard ISO/IEC/IEEE 29119-4 on test techniques. The ISTQB syllabi refer to it, and CTAL-TA v4.0 was updated to follow its 2021 edition.

Section sources

the section is written from these pages

End of the reference

What changed

revision history · 4 entries

Every edit is saved as a revision: a snapshot of the reference, the reason and a summary of changes. The published version changes only after the same checks as at creation.

  1. Manual edit

    reason: manual edit
  2. Manual edit

    reason: manual edit
  3. Manual edit

    reason: manual edit
  4. Reference updated

Weekly check

How the reference is checked

Once a week — and right after news of a release or a vulnerability — the reference is checked in three steps.

  1. 1. Freshness

    Sections are compared with the release notes and changelogs from the official sources and with the topic’s news.

  2. 2. Errors

    Every section is read again: wrong facts, outdated APIs and flags, broken examples.

  3. 3. Links — by an HTTP request

    Every source link must respond. A broken link is a reason to recheck the section.

No findings — only the date changes. Findings — only the affected sections are rewritten, and they appear in “What changed”. A new version replaces the published one only after passing the same checks as at creation.

Statuses

Verified
no findings
Updated
sections rewritten, edits are listed
Rechecking
while the check runs, the previous version stays open
Needs review
disputed points: the verified version is shown, editors review

Last check

18 Nov · Check · updated · no findings

Found an error in the reference?

On the topic

tracks, news and other references
The whole “Test design” topic
11 sections
Another reference · Testing (QA)

pytest

Verified 1 Nov
All references · 61