- 2069 Chaitra · 5 marks
Equivalence partitioning: telephone numbers
Short answer
Equivalence partitioning divides inputs into valid and invalid classes expected to behave alike, testing one representative from each class. For a 10-digit Pumpkin Republic number: valid classes are 10 digits, all digits, district 01-85, and service digit 1 or 2; invalid classes cover wrong length, non-digits, district 00 or 86-99, and service 0 or 3-9.
What is Equivalence Partitioning? Explain with an example of checking for a telephone number (of a Country called Pumpkin Republic, which has 85 districts altogether) entry like 4422561263, where first two digits signify the number of district, third digit for either PSTN (1) or Cellular (2) and remaining digits are just numbers.
Equivalence partitioning is a black-box testing technique that divides the input domain into equivalence classes. All values in one class are expected to be handled the same way by the program, so one test value from each class is enough. Classes are made for valid and invalid inputs. This reduces the number of test cases while still covering the input domain.
Example: Pumpkin Republic telephone number
Format of 4422561263 (10 digits):
4 4 | 2 | 2 5 6 1 2 6 3
District| Service| Subscriber number
(01-85)| 1=PSTN | (7 digits, 0-9)
| 2=Cell |
Assumptions: exactly 10 digits; districts 1–9 written as 01–09; the last 7 digits may be any digits.
Equivalence classes
| Condition | Valid classes | Invalid classes |
|---|---|---|
| Length | V1: exactly 10 | I1: fewer than 10; I2: more than 10 |
| Characters | V2: all digits | I3: contains letter/symbol/space |
| District (digits 1–2) | V3: 01 to 85 | I4: 00; I5: 86 to 99 |
| Service (digit 3) | V4: 1 (PSTN); V5: 2 (Cellular) | I6: 0 or 3 to 9 |
Test cases (one invalid class per invalid test, so the cause of rejection is clear)
| No. | Input | Classes covered | Expected |
|---|---|---|---|
| 1 | 4422561263 | V1, V2, V3, V5 | Valid (cellular) |
| 2 | 4412561263 | V1, V2, V3, V4 | Valid (PSTN) |
| 3 | 442256126 | I1 | Invalid length |
| 4 | 44225612634 | I2 | Invalid length |
| 5 | 44225A1263 | I3 | Invalid character |
| 6 | 0012561263 | I4 | Invalid district |
| 7 | 9022561263 | I5 | Invalid district |
| 8 | 4452561263 | I6 | Invalid service code |
Adding boundary values of the district class (01, 85 valid; 00, 86 invalid), e.g. 0112345678, 8522345678 and 8612345678, makes the test set stronger.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Poker test, 1000 four-digit numbers (2070 Magh) · Simulation and Modeling, chapter 6 · asked 3×
- Poker test, 1000 four-digit numbers (2069) · Simulation and Modeling, chapter 6 · asked 3×
- Poker test, 1000 four-digit numbers (2072 Magh) · Simulation and Modeling, chapter 6
- Sum of digits until single digit · Computer Programming, chapter 5 · asked 2×