
9.4. Equivalent Partitioning

In Equivalent Partitioning, EP (or Equivalent Class), we attempt to uncover classes of errors related to different class of input values. This will be done by dividing the input domain into classes of data based on corresponding expected output for which test cases can be generated. Each such class is referred to as equivalence classes for input conditions that would generate same result. Each such identified class is termed equivalent since the class generates same result.

An equivalence class in Equivalent Partitioning represents a set of valid input conditions. Equivalent Partitioning is applicable to:

Numeric Value

Range of Values

Set of related Values

Boolean Condition

as follows:

If an input condition specifies a specific value then

One valid and two invalid equivalence classes defined.

If an input condition specifies a range then

Two Boundary Values and two values inside each boundary value

If an input condition specifies a Boolean or a member of a set then

One valid and one invalid equivalence classes defined.

Test cases for each input domain data item developed and executed.

9.4.1. Using Equivalence Classes
Few possible programming elements wherein we can determine equivalent input classes are: Range; Value; Set ; Boolean.

Using Equivalence Classes Range: When the programming element is a range type, we can arrive at test cases using Equivalent Class as follows:
Lower bound
Lower bound + precision
Upper bound
Upper bound  precision

Using Equivalence Classes Value: When the programming element is a value type, we can arrive at test cases using Equivalent Class as follows:
Value + precision
Value
Value – precision

When the programming element is a set type, we can arrive at test cases using Equivalent Class as follows:
InSet
OutofSet

Using Equivalence Classes Boolean: When the programming element is a Boolean type, we can arrive at test cases using Equivalent Class as follows:
True
False

9.4.2. Illustration
Write Test Cases using Equivalence Partitioning for a requirement that is stated as follows:
“If the examination grading system, if the student scores 0 to less than 40 then assign E Grade, if the student scores between 40 to 49 then assign D Grade, if the student scores between 50 to 69 then assign C Grade, if the student scores between 70 to 84 then assign B Grade, and if the student scores 85 to 100 then assign A Grade.”

In the above problem definition, after analysis, we identify set of Output Values and corresponding set of input values producing same output. This analysis results in:

Values from 0 to 39 produce E Grade
Values from 40 to 49 produce D Grade
Values from 50 to 69 produce C Grade
Values from 70 to 84 produce B Grade
Values from 85 to 100 produce A Grade

Based on EP, we identify following input values to test each boundary:
For EP in range 0 to 39:

EP for producing E Grade, input values are 0 to 39, Here Minimum Value= 0, Maximum Value = 39, Precision is 1. Thus, input values for testing for this EP for Grade E are:
Minimum Value= 0
(Minimum Value+ precision)= 1
(Maximum Value precision)= 38
Maximum Value= 39

Thus, input values for Boundary Values 0 and 39 are:
0, 1, 38, 39
Output Value is:
Grade E

On the similar lines of analysis, we arrive at following input values for other EPs and corresponding outputs as:
For 40 to 49, we have 40, 41, 48, 49 and Output Value is “Grade D”
For 50 to 69, we have 50, 51, 58, 69 and Output Value is “Grade C”
For 70 to 84, we have 70, 71, 83, 84 and Output Value is “Grade B”
For 85 to 100, we have 85, 86, 99, 100 and Output Value is “Grade A”
In Addition to this, we have EP with input values 1 and 101 and corresponding output value is “Error”.
Thus
For 1and 101, we have Output Value as “Error”
For these boundaries, test cases based on EP technique are documented in Table 6.2 Test Case Design for a given example using EP Technique



Khannur's Book 

Arunkumar Khannur, Software Testing  Techniques and Applications,
Published by Pearson Publications, 2011
(ISBN:9788131758366; Pages:341 + xxii) 
Follow Khannur 

Khannur's Company 

ISQT Process & Consulting Services Pvt. Ltd., Bangalore, INDIA

Khannur's Software Testing Forum 

STEPAUTO Forum

Contact Khannur 
ISQT Process & Consulting Services Pvt. Ltd.
#732, 1st Floor, 12th Main,
3rd Block,
Rajajinagar,
Bangalore  560010, INDIA
Phone: +91 80 23012511
URL: www.isqtinternational.com
Email: khannur@isqtinternational.com
Skype: arun.isqt 
