Equivalence Partitioning

Equivalence partitioning (EP) is a black-box test design technique that divides the data a test object handles into partitions, also called equivalence classes. All values in a partition are expected to be processed the same way: if one value reveals a defect, any other value from that partition is assumed to reveal it too. So you test one value per partition, not every value.

Example: a shop accepts orders of 1 to 10 units. The quantity field has one valid partition, 1 to 10, and three invalid ones: below 1, above 10, and input that is not a whole number, such as 2.5 or two. Four tests, such as 4, -3, 25 and two, exercise all four partitions; adding 5 and 6 exercises nothing new.

Why it matters

Exhaustive testing is impossible, so every test suite is a sample; the question is whether the sample is chosen on purpose. Without partitions, testers tend to try several values that run through the same logic, such as 3, 5 and 7 for the quantity field, and never a value the system must reject. The suite looks busy and still misses whole behaviours.

With EP every test stands for one group of values that should behave alike. The suite stays small, a partition without a test is a visible gap, and you get a coverage figure you can defend in a review. Boundary value analysis is built directly on partitions, and decision table testing and pairwise testing often use partitions as the values they combine.

Valid and invalid partitions, one value from each

Partitions can be identified for any data element related to the test object: inputs, outputs, configuration items, internal values, time-related values and interface parameters. They may be continuous or discrete, ordered or unordered, finite or infinite, but they must never overlap and none may be empty.

A partition of values the test object should process is a valid partition; one with values it should reject or ignore is an invalid partition. The ISTQB syllabus notes that teams define "valid" and "invalid" differently (some call a value valid only when the specification defines how it is processed), so agree on the meaning first. Then pick one value from each partition. Any value will do; testers usually take a typical one from the middle and leave the edges to boundary value analysis.

  • Ranges: "1 to 10 units" gives one valid partition and an invalid one on each side.
  • Sets of values: "card, cash or wallet" gives one valid partition per value that is processed differently, plus an invalid partition for any other value.
  • Outputs: three fee tiers are three partitions, even when the input is a single number.
  • Doubt: if part of a partition may be treated differently, such as 0 among the values below 1, split the partition and ask.

Try it: Equivalence Partition Generator Try it: Negative Test Generator

Equivalence partition coverage

As in the lesson on the test design activity, coverage is counted over coverage items. In EP the coverage items are the partitions, valid and invalid. Coverage is the number of partitions exercised by at least one test case divided by the number of identified partitions, as a percentage.

The figure is only as good as the list behind it: a partition nobody identified is not counted, so coverage can read 100% while it is missing. Keep partitions in a test design that others can review, not only in your head.

Field: quantity, whole numbers, valid 1..10

Partitions:    Q1 below 1 (invalid)      Q2 1..10 (valid)
               Q3 above 10 (invalid)     Q4 not a whole number (invalid)

Tests so far:  4 -> Q2,  25 -> Q3
Coverage:      2 of 4 partitions = 50%

Add:           -3 -> Q1,  "two" -> Q4
Coverage:      4 of 4 partitions = 100%

Several parameters and each choice coverage

Most test objects take more than one input. Each parameter has its own set of partitions, and one test case uses a partition from every set at once. Combinations grow fast: three parameters with 3, 2 and 2 valid partitions give 3 × 2 × 2 = 12 combinations.

The simplest criterion for several sets is each choice coverage: every partition of every set is exercised by at least one test case, ignoring combinations. When all combinations are allowed, the valid partitions need only as many test cases as the parameter with the most valid partitions has. Combinations are the subject of pairwise testing later in this module.

Give each invalid partition its own test case and keep every other parameter valid, a rule widely used in practice. If one test sends two invalid values and the system stops at the first error message, the second partition is never really exercised: a defect in how the second value is handled stays hidden.

Worked example: a parcel shipping fee

Requirement: "Weight 0.1 to 2.0 kg costs 20 SAR, 2.1 to 10.0 kg costs 35 SAR, 10.1 to 30.0 kg costs 60 SAR. Weight has one decimal; parcels above 30.0 kg are refused. Destination is Domestic or GCC; GCC adds 30 SAR. Speed is Standard or Express; Express adds 25 SAR."

Weight has six partitions: zero or less, the three fee tiers, above 30.0 kg, and input that is not a number. Destination has three (Domestic, GCC, any other country) and speed two: 11 partitions, 7 valid and 4 invalid. If the field can receive a weight with two decimals, such as 2.05, ask whether it is rounded or rejected: the answer may add a partition.

In the shipping-fee example, parcel weight splits into five ordered partitions, two invalid and three valid fee tiers, and one weight is tested from each.

weight: kg, one decimal, accepted 0.1..30.0

Axis from 0 kg to 30 kg
  • ≤ 0.0W1 · invalid: zero or less
  • 0.1–2.0W2 · valid: 20 SAR
  • 2.1–10.0W3 · valid: 35 SAR
  • 10.1–30.0W4 · valid: 60 SAR
  • ≥ 30.1W5 · invalid: too heavy
  1. 1−2.0 kg TC4: refusedrepresents W1
  2. 21.5 kg TC1: 20 SARweight fee before add-ons
  3. 36.0 kg TC2: 35 SARweight fee before add-ons
  4. 418.5 kg TC3: 60 SARweight fee before add-ons
  5. 542.0 kg TC5: refusedrepresents W5

W6, input that is not a number (test case 6, abc), has no place on a number line, and neither do the destination and speed partitions; the table below lists all 11.

  • Test cases 1 to 3 reach each choice coverage of the valid partitions; three are enough because weight, the largest set, has three valid partitions.
  • Test cases 4 to 7 each cover one invalid partition with every other value valid. Seven test cases exercise all 11 partitions: 100% EP coverage.
  • If destination is a drop-down list, D3 cannot be chosen in the user interface; test it through the API, or ask whether the server validates it.
  • Not covered yet: combinations such as Express with the lightest tier, and the edges 0.0|0.1, 2.0|2.1, 10.0|10.1 and 30.0|30.1, which you can add with boundary value analysis, the technique of the next lesson.
Partitions
  Weight       W1 <= 0.0 (invalid)   W2 0.1-2.0 (valid)    W3 2.1-10.0 (valid)
               W4 10.1-30.0 (valid)  W5 > 30.0 (invalid)   W6 not a number (invalid)
  Destination  D1 Domestic (valid)   D2 GCC (valid)        D3 other country (invalid)
  Speed        S1 Standard (valid)   S2 Express (valid)

TC  Weight  Destination  Speed     Covers     Expected
1   1.5     Domestic     Standard  W2 D1 S1   fee 20 SAR
2   6.0     GCC          Express   W3 D2 S2   fee 35 + 30 + 25 = 90 SAR
3   18.5    Domestic     Express   W4 D1 S2   fee 60 + 25 = 85 SAR
4   -2.0    Domestic     Standard  W1         refused: weight must be above 0
5   42.0    Domestic     Standard  W5         refused: parcel over 30.0 kg
6   abc     Domestic     Standard  W6         refused: weight must be a number
7   1.5     Egypt        Standard  D3         refused: destination not served

Coverage: 11 of 11 partitions = 100% with 7 test cases

Try it: Test Case Generator Try it: Validation Test Generator

Common mistakes

  • Partitioning only inputs and forgetting outputs: three fee tiers fed by one weight field are three partitions.
  • Testing only valid partitions. Invalid ones count towards coverage, and they are where error handling breaks.
  • Putting several invalid values in one test case, so rejecting the first one hides how the others are handled.
  • Writing overlapping partitions such as "0 to 10" and "10 to 20"; each value belongs to exactly one partition.
  • Testing several values from the same partition and calling it thorough: more cost, no more coverage.
  • Treating 100% EP coverage as proof of quality; it only says each identified partition was exercised at least once.

The QA perspective

EP starts when you read the test basis. Every rule in a requirement or acceptance criterion suggests partitions, and every unclear rule is a question: "What happens to a weight of 0?", "Can a GCC parcel go Express?". Ask the product owner during refinement and write the answers down; they become your expected results.

Record partitions with ids (W1, D2…) in the test design, link each test case to the partitions it covers, and report EP coverage per feature, so reviewers can challenge a missing partition. When a test fails, name the partition as well as the value in the bug report: the whole group of values is probably affected, not just one number.

Practice exercise

Partition a cinema ticket form

Your task

A cinema booking form has two fields. Age in whole years: 0 to 12 pays the child price, 13 to 59 the adult price, 60 to 120 the senior price; other values are rejected. Seat type: Standard, Premium or VIP; anything else is rejected.

Identify the partitions of both fields and design the smallest test set that reaches 100% equivalence partition coverage, testing invalid partitions one at a time.

Steps
  1. List the partitions of each field, invalid ones included, with an id for each.
  2. Cover the valid partitions with each choice coverage.
  3. Add one test case per invalid partition, keeping the other field valid.
  4. Count partitions and test cases, and state the coverage.
Show the model answer
Model answer

Age: A1 below 0 (invalid), A2 0 to 12 child, A3 13 to 59 adult, A4 60 to 120 senior (valid), A5 above 120 (invalid), A6 not a whole number, such as ten or 7.5 (invalid). Seat type: T1 Standard, T2 Premium, T3 VIP (valid), T4 any other value (invalid). 10 partitions.

Valid, each choice, three test cases because both fields have three valid partitions: (8, Standard) covers A2 and T1; (35, Premium) A3 and T2; (70, VIP) A4 and T3.

Invalid, one at a time: (-5, Standard) A1; (130, Standard) A5; (ten, Standard) A6; (35, Balcony) T4.

Seven test cases cover all 10 partitions: 100% EP coverage. Ask whether a baby under one year is entered as 0 and whether 7.5 is rejected or rounded; if 7.5 and ten are handled differently, split A6 in two.

Frequently asked questions

Is an equivalence class the same as an equivalence partition?

Yes. Many books and tools, including the Mutqan Equivalence Partition Generator, say equivalence class; the ISTQB syllabus says equivalence partition. Both mean a set of values the test object is expected to process the same way.

Which value should I pick from a partition?

Any value is correct by the definition of the technique, because all values in a partition are assumed to behave alike. Testers usually take a typical value from the middle and leave the edges to boundary value analysis. If you suspect that one value behaves differently from the rest, the partitioning is probably wrong: split the partition.

Is each choice coverage enough when there are several parameters?

It is the minimum: every partition of every parameter is exercised once. It does not test interactions between parameters, so when the values of one parameter change the result of another, add combinations with decision table testing or pairwise testing.

References

  • ISTQB Certified Tester Foundation Level (CTFL) v4.0ISTQB · 2023The foundation syllabus of software testing: test levels and types, test design techniques, test management and tools.
  • ISTQB GlossaryISTQBThe standard definitions of testing terms — test case, regression testing, severity, priority, boundary value analysis and the rest.

Practise with Mutqan tools

Generate negative test cases for form fields and APIs: empty, null, wrong type, too long, injection, invalid format.

Test Design

Generate validation test cases for form fields: required, format, length, range, pattern and cross-field rules.

Test Design

Generate structured test cases (id, title, preconditions, steps, expected result, priority) from a feature description and field list.

Test Design

Go deeper

Your progress on this topic

Part of the QA Roadmap