🔹 What is Equivalence Partitioning?
Equivalence Partitioning (EP) is a Black Box Testing technique where input values are divided into logical groups (partitions), and only one value from each group is tested. The assumption is that all values in a partition behave the same way, so testing one value represents the entire group.
📌 Example: If an input field accepts numbers from 1 to 100, we divide the input into three partitions:
- Invalid Partition (Below Range):
≤ 0
- Valid Partition:
1 – 100
- Invalid Partition (Above Range):
≥ 101
Instead of testing all 100 valid values, we test one value from each partition (e.g.,0, 50, 101
).
🔹 Why Use Equivalence Partitioning?
✅ Reduces the Number of Test Cases → No need to test every possible input.
✅ Covers a Wide Range of Values → Ensures different cases are tested.
✅ Detects Input Validation Issues → Quickly finds incorrect handling of input.
✅ Useful for UI & Form Testing → Validates input fields efficiently.
🔹 Example Scenarios for Equivalence Partitioning
📌 Example 1: Age Validation (Valid Range: 18 to 60)
Partition Type | Test Case Example | Expected Result |
---|---|---|
Invalid (Below 18) | 17 | ❌ Error (Too Young) |
Valid (Between 18-60) | 30 | ✅ Accepted |
Invalid (Above 60) | 61 | ❌ Error (Too Old) |
📌 Explanation: Instead of testing all ages, we test one value per partition:
- Invalid Partition (17) → Should be rejected
- Valid Partition (30) → Should be accepted
- Invalid Partition (61) → Should be rejected
📌 Example 2: ATM Withdrawal (Valid Range: $100 – $5000, Multiples of $10 Only)
Partition Type | Test Case | Expected Outcome |
---|---|---|
Invalid (Below Min) | $50 | ❌ Error |
Valid Range | $1000 | ✅ Approved |
Invalid (Above Max) | $5500 | ❌ Error |
Invalid (Not a Multiple of 10) | $125 | ❌ Error |
📌 Explanation: We test only one value per partition instead of all possible amounts.
📌 Example 3: Password Field (Min 8 – Max 20 Characters)
Partition Type | Test Case Example | Expected Result |
---|---|---|
Invalid (Too Short) | "abc123" | ❌ Error |
Valid (Correct Length) | "password1234" | ✅ Accepted |
Invalid (Too Long) | "thisisaverylongpassword123" | ❌ Error |
📌 Explanation: Instead of testing every possible password length, we test:
- Invalid Partition:
"abc123"
(Too short) - Valid Partition:
"password1234"
(Accepted) - Invalid Partition:
"thisisaverylongpassword123"
(Too long)
🔹 Types of Equivalence Partitioning
1️⃣ Weak Equivalence Partitioning
- Divides input into broad categories (Valid/Invalid).
📌 Example: If valid input is 1 – 100, test only one valid and one invalid value.
2️⃣ Strong Equivalence Partitioning
- Divides inputs into multiple partitions for detailed testing.
📌 Example: A grading system (0-49 = Fail, 50-75 = Pass, 76-100 = Distinction).
We test one value per grade:25 (Fail)
,60 (Pass)
,85 (Distinction)
.
3️⃣ Boundary-Based Equivalence Partitioning
- Combines Equivalence Partitioning + Boundary Value Testing.
📌 Example: A form allows ages 18 to 60 → Test 17, 18, 59, 60, 61 (minimum, maximum, and boundaries).
🔹 Difference Between Equivalence Partitioning & Boundary Value Testing
Feature | Equivalence Partitioning (EP) | Boundary Value Testing (BVT) |
---|---|---|
Concept | Tests one value per range | Tests extreme min/max values |
Number of Test Cases | Fewer | More (tests boundaries) |
Focus | Ensures each partition behaves the same | Detects issues at limits |
Example (Age 18-60) | Test one value (30) | Test 18, 60, and edges (17, 19, 59, 61) |
🔹 When to Use Equivalence Partitioning?
✔ When input has a defined range (e.g., age limits, salary range).
✔ When testing form fields (e.g., phone number, password length).
✔ When optimizing test cases (avoiding unnecessary repetitions).
✔ When testing numerical, date, or text-based inputs.