You already know that exhaustive testing is impossible. So how does a tester choose which values to test? The answer is test design techniques. In black box testing the tester designs tests from requirements and behaviour without looking at the internal code. The two most widely used black box techniques are Equivalence Partitioning (EP) and Boundary Value Analysis (BVA). They are simple, powerful, and asked about in almost every testing interview, often as a live exercise.
Equivalence Partitioning (EP)
Equivalence partitioning divides input data into groups, called partitions or classes, where the system is expected to behave the same way for every value in the group. If one value in a partition works, the others should work too; if one fails, the others should fail in the same way. So you test one representative value per partition instead of every value.
Partitions can be valid (values the system should accept) or invalid (values the system should reject).
Worked example 1: Age field
Requirement: "A health insurance purchase form accepts applicant age from 18 to 60 years (whole numbers only)."
| Partition | Range | Type | Representative value | Expected result |
|---|---|---|---|---|
| P1 | Less than 18 | Invalid | 10 | Error: age must be between 18 and 60 |
| P2 | 18 to 60 | Valid | 35 | Accepted |
| P3 | Greater than 60 | Invalid | 72 | Error: age must be between 18 and 60 |
| P4 | Non-numeric | Invalid | "abc" | Error: enter a valid number |
| P5 | Decimal number | Invalid | 25.5 | Error: whole numbers only |
| P6 | Blank | Invalid | (empty) | Error: age is required |
With six well-chosen inputs you cover the behaviour of the entire field. Notice that a good tester thinks beyond the numeric range and includes partitions for wrong data types and empty input.
Test each invalid partition in a separate test case, keeping all other fields valid. If you enter an invalid age and an invalid mobile number together, one error may hide the other, and you will not know which validation actually works.
Boundary Value Analysis (BVA)
Experience shows that defects are very common at the edges of partitions. Developers often write > instead of >=, or < 60 instead of <= 60. Boundary value analysis tests values at and around these edges.
- Two-value BVA: for each boundary, test the boundary value and its nearest neighbour in the adjacent partition. For 18–60: 17, 18, 60, 61.
- Three-value BVA: test the boundary and both neighbours. For 18–60: 17, 18, 19, 59, 60, 61.
Worked example 1 continued: Age 18 to 60
| Value | Position | Expected result |
|---|---|---|
| 17 | Just below minimum | Rejected |
| 18 | Minimum | Accepted |
| 19 | Just above minimum | Accepted |
| 59 | Just below maximum | Accepted |
| 60 | Maximum | Accepted |
| 61 | Just above maximum | Rejected |
If the developer wrote age > 18 by mistake, the test with 18 fails and the defect is caught immediately. A random value like 35 would never reveal it.
Worked example 2: Password length
Requirement: "Password must be 8 to 16 characters long."
| Technique | Values (length in characters) |
|---|---|
| EP | 5 (invalid, too short), 12 (valid), 20 (invalid, too long) |
| BVA (three-value) | 7, 8, 9, 15, 16, 17 |
Worked Example 3: Multiple Partitions (Discount Slabs)
Requirement: "On an e-commerce app, cart value in whole rupees determines the discount: ₹1–₹499 no discount, ₹500–₹1,999 get 5% off, ₹2,000–₹50,000 get 10% off. Cart value above ₹50,000 cannot be checked out online."
| Partition | Range (₹) | Expected behaviour | Boundary values to test |
|---|---|---|---|
| Invalid | 0 or less | Checkout not allowed | 0 |
| Valid A | 1 – 499 | No discount | 1, 499 |
| Valid B | 500 – 1,999 | 5% discount | 500, 1,999 |
| Valid C | 2,000 – 50,000 | 10% discount | 2,000, 50,000 |
| Invalid | Above 50,000 | Checkout blocked with message | 50,001 |
Using two-value BVA, the final test values are 0, 1, 499, 500, 1999, 2000, 50000, 50001. You can add one mid-value per valid partition (for example 250, 1,200 and 10,000) from EP. With about 11 inputs, you have strong coverage of a rule that has fifty thousand possible values.
If the cart value can include paise, the boundary between "no discount" and "5%" becomes ₹499.99 and ₹500.00. Always check the precision the requirement allows, because the "nearest neighbour" depends on it.
Steps to Apply EP and BVA Together
- Read the requirement and identify each input or output condition with a range or set of values.
- List valid partitions and invalid partitions, including wrong data types and blank input.
- Pick one representative value from each partition.
- Identify every boundary between partitions and add boundary values.
- Remove duplicates and write the expected result for each value.
- Ask the business analyst about any boundary the requirement does not define clearly.
A common interview question is: "A field accepts 1 to 100. What will you test?" Answer with structure: "EP gives me three partitions with values like 0 or -5, 50 and 150. BVA gives me 0, 1, 2, 99, 100 and 101. I will also test blank, alphabets, special characters and decimals as invalid partitions."
Common Mistakes to Avoid
- Testing only valid values and forgetting invalid partitions.
- Combining several invalid values in one test case.
- Ignoring output partitions, such as different discount amounts or messages.
- Assuming boundaries without checking whether limits are inclusive ("up to 60" versus "below 60").