Articles

Loading

Equivalence Class Partitioning

System Testing
Author
inar
Date
2013-06-05 23:59
Views
47343650

What is "Equivalence Class Partitioning"?

We define "Equivalence Class Partitioning" as a method that can help you derive test cases. You identify classes of input or output conditions. The rule is that each member in the class causes the same kind of behavior of the system. In other words, the "Equivalence Class Partitioning" method creates sets of inputs or outputs that are handled in the same way by the application.

Another definition taken from Wikipedia:
"A technique in black box testing. It is designed to minimize the number of test cases by dividing tests in such a way that the system is expected to act the same way for all tests of each equivalence partition. Test inputs are selected from each class. Every possible input belongs to one and only one equivalence partition."

Why learn "Equivalence Class Partitioning"?

This method drastically reduces the number of test cases that are required to be tested because we don't have time, money or manpower to test everything. In addition, it can help you find many errors with the smallest number of test cases.

How to use "Equivalence Class Partitioning"?

There are 2 major steps we need to do in order to use equivalence class partitioning:
  • Identify the equivalence classes of input or output. Take each input's or output's condition that is described in the specification and derive at least 2 classes for it:
    • One class that satisfies the condition – the valid class.
    • Second class that doesn't satisfy the condition – the invalid class.
  • Design test cases based on the equivalence classes.

Example 1

In a computer store, the computer item can have a quantity between -500 to +500. What are the equivalence classes?
Answer: Valid class: -500 <= QTY <= +500
                Invalid class: QTY > +500
                Invalid class: QTY < -500
Example 2
In a computer store, the computer item type can be P2, P3, P4, and P5 (each type influences the price). What are the equivalence classes?
Answer: Valid class: type is P2
                Valid class: type is P3
                Valid class: type is P4
                Valid class: type is P5
                Invalid class: type isn’t P2, P3, P4 or P5
Practice
Bank account can be 500 to 1000 or 0 to 499 or 2000 (the field type is integer). What are the equivalence classes?
Try to solve it before reading the answer.
Practice 1 - answer
  • Valid class: 0 <= account <= 499
  • Valid class: 500 <= account <= 1000
  • Valid class: 2000 <= account <= 2000
  • Invalid class: account < 0
  • Invalid class: 1000 < account < 2000
  • Invalid class: account > 2000

Equivalence Class Vs Boundary Testing

Let us discuss about the difference between Equivalence class and boundary testing. For the discussion we will use the practice question:
Bank account can be integer in the following ranges: 500 to 1000 or 0 to 499 or 2000. What are the equivalence classes?
Answer:
  • valid class: 0 <= account <= 499
  • valid class: 500 <= account <= 1000
  • valid class: 2000 <= account <= 2000
  • invalid class: account < 0
  • invalid class: 1000 < account < 2000
  • invalid class: account > 2000
In equivalence class, you need to take one value from each class and test whether the value causes the system to act as the class' definition. It means that in this example, you need to create at least 6 test cases – one for each valid class and one for each invalid class.
How many test cases will be, if you use boundary testing?
The following table shows how much test cases will be using "Boundary Testing" method:
 

Test Case #

Value

Result

1

-1Invalid

2

0Valid

3

1Valid

4

498Valid

5

499Valid

6

500Valid

7

501Valid

8

999Valid
91000Valid
101001Invalid
111999Invalid
122000Valid
132001Invalid

In boundary testing, you need to test each value in the boundary and you know the value, you don't need to choose it from any set. In this example you have 13 test cases.

Now, let us exam how to combine this 2 methods together.
The following table shows all the boundary testing values and their equivalence classes:

#

Boundary Value

Equivalence Class

Result

1

-1account < 0Invalid 

2

00 <= account <= 499Valid 

3

10 <= account <= 499Valid 

4

4980 <= account <= 499Valid 

5

4990 <= account <= 499Valid 

6

500500 <= account <= 1000 Valid

7

501500 <= account <= 1000Valid 

8

999500 <= account <= 1000Valid 
91000500 <= account <= 1000 Valid
1010011000 < account < 2000Invalid 
1119991000 < account < 2000 Invalid
1220002000 <= account <= 2000Valid 
132001account > 2000Invalid 

Now, we can reduce some of the test cases that belong to the same equivalence class. We can delete lines 3 and 4 which belong to equivalence class "0 <= account <= 499". We also can delete lines 7 and 8 hich belong to "500 <= account <= 1000". The new table will be:

#
Boundary Value
Equivalence Class
Result
1
-1account < 0Invalid 
2
00 <= account <= 499Valid 
5
4990 <= account <= 499Valid 
6
500500 <= account <= 1000 Valid
91000500 <= account <= 1000 Valid
1010011000 < account < 2000Invalid 
1119991000 < account < 2000 Invalid
1220002000 <= account <= 2000Valid 
132001account > 2000Invalid 

You can even reduce more test cases although in my opinion, it is important to keep this table because it keeps a hard connection to the boundary testing. You can see in the table that I didn't reduce those test cases that are touch in the boundary itself of each range.
Let's reduce more test cases (just for the fun and for the practice (test case 5, 9 and 10):
#
Boundary Value
Equivalence Class
Result
1
-1account < 0Invalid 
2
00 <= account <= 499Valid 
6
500500 <= account <= 1000 Valid
1119991000 < account < 2000 Invalid
1220002000 <= account <= 2000Valid 
132001account > 2000Invalid 
Now, in this table, for each equivalence class, you choose one value that belongs to boundary testing.
A smart man once told me that when I write a test case and I using equivalence class partitioning, not to write specific values. Instead, he told me to write the classes and their expected results. By that, each time a tester will run the test case he will choose new candidates from each class. Using that working method we can promise that each running will contain new values.  
Total Reply 4

  • 2012-08-06 19:30

    good article ... comprehensive and accurate ... detailed and easy to understand .... must read ... thanks for sharing


  • 2012-09-05 09:41

    very thanks for your article


  • 2012-09-12 20:51

    very thanks for your article


  • 2012-09-22 14:19

    good article


Total 20,613
Number Title Author Date Votes Views
20613
SileniusStor is specialized in reselling Cheap Aquafadas software online.
Softwareces | 2022.09.15 | Votes 0 | Views 45048873
Softwareces 2022.09.15 0 45048873
20612
CSStore is specialized in reselling Cheap Steinberg software online.
Softwareces | 2022.09.04 | Votes 0 | Views 44985859
Softwareces 2022.09.04 0 44985859
20611
Software Tester Community Website
ItSeTsQtBer | 2021.04.11 | Votes 0 | Views 45716043
ItSeTsQtBer 2021.04.11 0 45716043
20610
SoapUI Certification Course Content
Steveskok | 2021.02.08 | Votes 0 | Views 45402648
Steveskok 2021.02.08 0 45402648
20609
JavaScript Course Content
Steveskok | 2021.02.08 | Votes 0 | Views 45670662
Steveskok 2021.02.08 0 45670662
20608
Why most mobile testing is not continuous?
(TestExpert) | 2021.02.04 | Votes 0 | Views 46039506
(TestExpert) 2021.02.04 0 46039506
20607
8 Common Mistakes When Planning and Documenting Your Tests
(TestExpert) | 2021.02.04 | Votes 0 | Views 46799212
(TestExpert) 2021.02.04 0 46799212
20606
Types of Performance Testing
Jamessmith | 2021.01.17 | Votes 0 | Views 46153262
Jamessmith 2021.01.17 0 46153262
20605
How to Build E2E Test Cases (1)
tanthanh | 2020.05.28 | Votes 0 | Views 46320028
tanthanh 2020.05.28 0 46320028
20604
[White Paper] Delivering better software using Test Automation
tanthanh | 2020.05.28 | Votes 0 | Views 45863257
tanthanh 2020.05.28 0 45863257
20603
[Whitepaper] How to choose the right API Testing Solution
tanthanh | 2020.05.28 | Votes 0 | Views 45771333
tanthanh 2020.05.28 0 45771333
20602
[Whitepaper] How to choose the right API Testing Solution
tanthanh | 2020.05.28 | Votes 0 | Views 45539628
tanthanh 2020.05.28 0 45539628
20601
TestOps Introduction
VTB | 2020.03.23 | Votes 0 | Views 45301412
VTB 2020.03.23 0 45301412
20600
TestOps Implementation Case Study
VTB | 2020.03.23 | Votes 0 | Views 46130861
VTB 2020.03.23 0 46130861
20599
Selenium Automation Tester Certification Sample Exam Set 3
(TestExpert) | 2020.02.03 | Votes 0 | Views 46141021
(TestExpert) 2020.02.03 0 46141021
20598
Selenium Automation Tester Certification Sample Exam Set 2
(TestExpert) | 2020.02.03 | Votes 0 | Views 46039685
(TestExpert) 2020.02.03 0 46039685
20597
Selenium Automation Tester Certification : Sample Exam Set 1
(TestExpert) | 2020.02.03 | Votes 0 | Views 45673535
(TestExpert) 2020.02.03 0 45673535
20596
What is agile testing? why is agile testing? and what is the benefits? (20)
oishichip | 2019.12.26 | Votes 0 | Views 44995461
oishichip 2019.12.26 0 44995461
20595
Crowd Testing — Vantagens para testadores, plataformas e clientes [pt-br]
soikmd2 | 2019.12.14 | Votes 0 | Views 45450320
soikmd2 2019.12.14 0 45450320
20594
Software Testing Industry Report (Turkey) 2018-2019 (2)
ItSeTsQtB | 2019.08.08 | Votes 0 | Views 46076382
ItSeTsQtB 2019.08.08 0 46076382
20593
How to bypass security in integration tests in ASP.Net Core
ItSeTsQtB | 2019.08.08 | Votes 0 | Views 46895884
ItSeTsQtB 2019.08.08 0 46895884
20592
For agile testing, fail fast with test impact analysis
ItSeTsQtB | 2019.08.08 | Votes 0 | Views 46683846
ItSeTsQtB 2019.08.08 0 46683846
20591
Career Path in Software Testing
^Software^ | 2019.07.28 | Votes 0 | Views 46164187
^Software^ 2019.07.28 0 46164187
20590
Challenges in Big Data Testing
^Software^ | 2019.07.22 | Votes 0 | Views 45719544
^Software^ 2019.07.22 0 45719544
20589
Essential Necessities In Big Data Testing
^Software^ | 2019.07.22 | Votes 0 | Views 45120282
^Software^ 2019.07.22 0 45120282
20588
5 Test Data Generation Techniques
^Software^ | 2019.07.22 | Votes 0 | Views 45851838
^Software^ 2019.07.22 0 45851838
20587
CI and CD for ETL (Extract-Transform-Load) testing.
^Software^ | 2019.07.22 | Votes 0 | Views 45826493
^Software^ 2019.07.22 0 45826493
20586
Quest for Quality Conference : 5-6 Nov 2019 at Dublin, Ireland
VTB | 2019.07.08 | Votes 0 | Views 45729447
VTB 2019.07.08 0 45729447
20585
TestBash Essentials Conference 2019
VTB | 2019.07.08 | Votes 0 | Views 45836537
VTB 2019.07.08 0 45836537
20584
UKSTAR Conference : 11-03-2019
VTB | 2019.07.08 | Votes 0 | Views 45826839
VTB 2019.07.08 0 45826839
20583
Testing in Context Conference Australia (TiCCA) 2019
VTB | 2019.07.08 | Votes 0 | Views 45115760
VTB 2019.07.08 0 45115760
20582
European Testing Conference 2019
VTB | 2019.07.08 | Votes 0 | Views 45805179
VTB 2019.07.08 0 45805179
20581
Automation Guild Online Conference 2019
VTB | 2019.07.08 | Votes 0 | Views 46695320
VTB 2019.07.08 0 46695320
20580
Software Quality Days 2019 : 15 Jan 2019 (1)
VTB | 2019.07.08 | Votes 0 | Views 46080283
VTB 2019.07.08 0 46080283
20579
Skills required to become a Software Tester (1)
IT-Tester | 2019.07.08 | Votes 0 | Views 45846538
IT-Tester 2019.07.08 0 45846538
20578
Automated Unit Testing with Randoop, JWalk and µJava versus Manual JUnit Testing
IT-Tester | 2019.07.08 | Votes 0 | Views 44788504
IT-Tester 2019.07.08 0 44788504
20577
Scrum Testing Guide Book (2)
IT-Tester | 2019.06.26 | Votes 0 | Views 45102945
IT-Tester 2019.06.26 0 45102945
20576
Acceptance Testing Definition in Testing vs Scrum
IT-Tester | 2019.06.26 | Votes 0 | Views 45887530
IT-Tester 2019.06.26 0 45887530
20575
User Acceptance Testing Checklist
VTB | 2019.06.20 | Votes 0 | Views 45920746
VTB 2019.06.20 0 45920746
20574
Firewalls and Types (1)
VTB | 2018.11.14 | Votes 0 | Views 45290602
VTB 2018.11.14 0 45290602
20573
Senior Test Engineer (1)
VTB | 2018.11.05 | Votes 0 | Views 45760640
VTB 2018.11.05 0 45760640
20572
Junior Test Analyst
kornadian2 | 2018.11.04 | Votes 0 | Views 45708544
kornadian2 2018.11.04 0 45708544
20571
Senior Test Engineer
kornadian2 | 2018.11.04 | Votes 0 | Views 45535304
kornadian2 2018.11.04 0 45535304
20570
Programme Test Manager, 12m, Immed Start, $NEG
kornadian2 | 2018.11.04 | Votes 0 | Views 46972116
kornadian2 2018.11.04 0 46972116
20569
Junior Test Analyst
kornadian2 | 2018.11.04 | Votes 0 | Views 45991837
kornadian2 2018.11.04 0 45991837
20568
Dev & Test Manager
kornadian2 | 2018.11.04 | Votes 0 | Views 46666704
kornadian2 2018.11.04 0 46666704
20567
Senior Test Analyst (Performance Tester)
kornadian2 | 2018.11.04 | Votes 0 | Views 46615694
kornadian2 2018.11.04 0 46615694
20566
QA Automation Test Analyst
kornadian2 | 2018.11.04 | Votes 0 | Views 45686389
kornadian2 2018.11.04 0 45686389
20565
Software/Field Testing Engineer
kornadian2 | 2018.11.04 | Votes 0 | Views 45573772
kornadian2 2018.11.04 0 45573772
20564
Compliance Technician (Tester)
kornadian2 | 2018.11.04 | Votes 0 | Views 45201268
kornadian2 2018.11.04 0 45201268