Equivalence Partitioning
Equivalence Partitioning is a black-box testing technique that divides the input data of a system into partitions of equivalent data. The method assumes that testing one value from each partition is sufficient to validate the behavior for that entire partition, thus reducing the number of test cases needed.
First used·1970s
Definitions·1
Synonyms·2
Category·Software Testing
Also known as
Definitions
What it means.
- 01
Equivalence Partitioning in Software Testing
Equivalence Partitioning, also known as Equivalence Class Partitioning (ECP), is a black-box software testing technique that divides the input data of a software unit into partitions of equivalent data from which test cases can be derived. The core principle is that if one test case from a partition reveals a defect, all other test cases in the same partition are likely to reveal the same defect.
This method significantly reduces the number of test cases required to test a system effectively, compared to exhaustive testing. It ensures that a representative value from each 'class' of input is tested, providing broad coverage of the input domain.
How It Works
The process involves two main steps:
- Identify Equivalence Classes: Analyze the input requirements and split the input domain into classes or partitions. For each input condition, you identify at least one valid class and one or more invalid classes.
- Design Test Cases: Select one value from each partition to create your test cases. The goal is to cover all identified partitions with a minimal number of tests.
Example: Age Input Field
Consider a system that requires a user's age, which must be between 18 and 60, inclusive.
Using Equivalence Partitioning, we can identify the following classes:
- Partition 1 (Invalid): Age < 18 (e.g., test with
10) - Partition 2 (Valid): 18 ≤ Age ≤ 60 (e.g., test with
35) - Partition 3 (Invalid): Age > 60 (e.g., test with
65) - Partition 4 (Invalid): Non-numeric input (e.g., test with
"ABC")
Instead of testing every possible age, we can create just four test cases, one for each partition, to achieve good coverage of the input validation logic.
Origin
Where it comes from.
Etymology
The term is a composite of 'Equivalence' and 'Partitioning'. 'Equivalence' originates from the Latin 'aequivalens', meaning 'of equal value or power'. 'Partitioning' means to divide something into parts. In this context, it means dividing the input domain into partitions where all data within a partition is of 'equal value' in terms of how the system is expected to process it.
Historical context
The concept of Equivalence Partitioning was formalized and popularized in the 1970s as software development matured into a more structured engineering discipline. Before this period, software testing was often an ad-hoc and exhaustive process, which became impractical as programs grew in complexity.
Glenford J. Myers' influential book, "The Art of Software Testing" (1979), was a key milestone. It systematically described black-box testing techniques, including Equivalence Class Partitioning (ECP) and Boundary Value Analysis. Myers articulated the idea that you don't need to test every possible input. Instead, you can select a single representative from a 'class' of inputs that the system should treat identically. This approach provided a logical and efficient method for selecting test cases, helping to transform testing from a brute-force activity into a strategic process focused on maximizing defect detection with minimal effort.
Usage
In context.
To test the new discount code feature, the team applied Equivalence Partitioning to create test cases for valid codes, expired codes, and syntactically incorrect codes.
The test plan specifies that Equivalence Class Partitioning (ECP) should be used to define the minimum set of tests for the user's age verification.
By using Equivalence Partitioning, we reduced our test suite from hundreds of potential inputs to just five carefully selected test cases.
A junior tester learned that combining Equivalence Partitioning with Boundary Value Analysis is a highly effective strategy for testing numerical input fields.
FAQ
Common questions.
The primary goal of Equivalence Partitioning is to optimize testing efforts by reducing the total number of test cases to a manageable set while maintaining high-quality test coverage. It achieves this by dividing the input data into equivalence classes and testing only one representative value from each class, working under the assumption that all values in a class will be handled identically by the software.
Taxonomy
Filed under.
Categories
Tags