Equivalence Partitioning (also known as Equivalence Class Partitioning) is a black box test design technique used in software testing. It helps reduce the number of test cases while still covering a wide range of inputs.
Instead of testing every possible value, we divide input data into equivalence classes. A single test case from each class is enough to represent the whole class. The logic is simple: if one value in the class works, the others will too.
What is an Equivalence Partition?
An equivalence partition is a group of inputs that are treated the same by the system. Each partition is assumed to be processed in the same way, so one test case per group is sufficient.
Example
Let’s say a form accepts ages between 18 and 60.
You can create three partitions:
1. Valid: 18 to 60
2. Invalid: Less than 18
3. Invalid: More than 60
So, instead of testing every age, you pick:
– One value from the valid range (e.g., 30)
– One value below the range (e.g., 16)
– One value above the range (e.g., 65)
What is Equivalence Class Partitioning?
Equivalence Class Partitioning is another name for equivalence partitioning. Both refer to the same technique—dividing input data into valid and invalid partitions.
This method improves test efficiency and helps avoid redundant test cases.
What is Boundary Value Analysis and Equivalence Partitioning?
While equivalence partitioning checks data within ranges, boundary value analysis (BVA) focuses on the edges of those ranges.
Using the same age input example:
– Equivalence Partitioning tests: 16, 30, 65
– Boundary Value Analysis tests: 17, 18, 60, 61
Both techniques are often used together for thorough testing.
What is Equivalence Partitioning Testing?
It is a black-box testing approach. You don’t look at the internal code. You only focus on the input and output.
You test:
– One value from each partition
– Expect consistent behavior across the class
– It saves time, reduces test cases, and maintains good test coverage.
How to Write Test Cases for Equivalence Partitioning?
Let’s take a few examples.
Example 1: Login Password Length
Requirement: Password must be between 6 and 12 characters.
Partitions:
– Valid: 6–12 characters
– Invalid: Less than 6
– Invalid: More than 12
Test Cases:
– Valid: “secret1” (7 characters)
– Invalid: “abc” (3 characters)
– Invalid: “verylongpasswordhere” (20 characters)
Example 2: ATM Withdrawal
Requirement: Withdrawals allowed from ₹100 to ₹10,000 in multiples of ₹100.
Partitions:
– Valid: ₹100, ₹5000, ₹10,000
– Invalid: ₹99, ₹10,001
– Invalid (non-multiples): ₹550
Test Cases:
– Valid: ₹1000
– Invalid: ₹50
– Invalid: ₹10,500
– Invalid: ₹675
Example 3: Email Field
Requirement: Email should contain @ and end with .com
Partitions:
– Valid: test@example.com
– Invalid: testexample.com (no @)
– Invalid: test@example (no .com)
Real-Life Example: Booking Movie Tickets
A booking system allows you to book between 1 and 6 tickets.
Partitions:
– Valid: 1 to 6 tickets
– Invalid: 0 tickets
– Invalid: More than 6 tickets
Test Inputs:
– 1 (valid)
– 0 (invalid)
– 7 (invalid)
Why Use Equivalence Partitioning?
- Reduces the number of test cases
- Covers all input categories
- Finds bugs in both valid and invalid input areas
- Saves testing time
Summary
Equivalence partitioning is one of the most useful black-box testing techniques. It makes testing smarter, not harder. By identifying input classes, you reduce unnecessary effort while maintaining good coverage.
When combined with boundary value analysis, it becomes a powerful tool for validating user input and system behavior.
👉 Looking for common manual testing interview questions? Check out this detailed guide to prepare for your next interview.