Which Problems Does Equivalence Class Testing Tend to Alleviate

Which Problems Does Equivalence Class Testing Tend to AlleviateWhich Problems Does Equivalence Class Testing Tend to Alleviate

If you want to make sure that a certain software program behaves correctly for different inputs, be ready to test all possible values ​​for each element of inputs (and also all possible combinations of input parameters).

 

There is an example. Assuming that we are testing a module for Recruitment Department that decides how we should manage job applications based on a person’s age.

 

The example is taken from the book’ A Practitioner’s guide to Software Test Design’ (Lee Copeland).

 

We will have the following age requirements:

 

  • 0-13 years – do not to hire;
  • 14-17 years – hire on a part-time basis;
  • 18-54 years – hire on a full-time basis;
  • 55-99 years – do not hire.

 

All possible valid data (only valid!) can be verified by testing the module for input numbers between 0 to 99. (There is a possibility to enter negative numbers and non-numeric data) So is it necessary to test all numbers from 0 to 99? If the module examines each number separately, this way, then apparently, yes:

 …

 if (age == 13) hireStatus = “NO”;

 if (age == 14) hireStatus = “PART”;

 if (age == 15) hireStatus = “PART”;

 if (age == 16) hireStatus = “PART”;

 if (age == 17) hireStatus = “PART”;

 if (age == 18) hireStatus = “FULL”;

 …

But fortunately, code is not written in a different way:

 

 if (age> = 0 && age <= 13)

           hireStatus = “NO”;

 if (age> = 14 && age <= 17)

           hireStatus = “PART”;

 if (age> = 18 && age <= 54)

           hireStatus = “FULL”;

 if (age> = 55 && age <= 99)

           hireStatus = “NO”;

It becomes obvious that you can test one of the numbers in each range. For example: 5, 15, 20, 60. And also the boundary values ​​(the first and last values ​​from each range): 0, 13, 14, 17, 18, 54, 55, 99.

 

The number of test values can be reduced by doing the following:

 

  1. a) dividing all values of input variable into subsets (equivalence classes), and then
  2. b) testing any single value from each class.

 

All values ​​from each subset must be equivalent to our tests. That is, if the test for one value in the equivalence class passes successfully, it must pass successfully for all the others.

Conversely, if the test for one value fails, it will not pass for all the others.

 

In this case we have 12 equivalence classes (each of the 8 boundary values ​​is actually a separate class).

 

You need to conduct 12 tests to check whether or not the program works correctly for all valid data.

 

Non-allowable data are tested in the same way – you can split them into equivalence classes “fractional number from 0 to 99”, “negative number”, “number greater than 99”, “set of letters”, “empty string”, etc.

 

Thus, equivalence class testing can be divided into three stages:

 

  1.       Valid value testing.
  2.       Invalid value testing.
  3.       Boundary value analysis.

 

Looking for the best software qa company to help you develop better IT products?

TestMatick is a world-class provider of testing & quality assurance services that knows

how to address all your testing / qa needs and accomplish all your objectives within

limited timeframe and budget.

   

Be the first to comment on "Which Problems Does Equivalence Class Testing Tend to Alleviate"

Leave a comment

Your email address will not be published.


*