Friday, December 28, 2007

Equivalence partitioning

Equivalence partitioning:


Equivalence partitioning is a method for deriving test cases. In this method, classes of input conditions called equivalence classes are identified such that each member of the class causes the same kind of processing and output to occur.

In this method, the tester identifies various equivalence classes for partitioning. A class is a set of input conditions that are is likely to be handled the same way by the system. If the system were to handle one case in the class erroneously, it would handle all cases erroneously.

Equivalence partitioning drastically cuts down the number of test cases required to test a system reasonably. It is an attempt to get a good 'hit rate', to find the most errors with the smallest number of test cases.

To use equivalence partitioning, you will need to perform four steps:

  • Determining conditions to be Tested
  • Defining Tests
  • Designing test cases
  • Identifying Final set of Test Cases

Defining Tests

A number of items must be considered when determining the tests using the equivalence partitioning method, like:
  • All valid input data for a given condition are likely to go through the same process.
  • Invalid data can go through various processes and need to be evaluated more carefully. For example,
  • a blank entry may be treated differently than an incorrect entry,
  • a value that is less than a range of values may be treated differently than a value that is greater,
  • if there is more than one error condition within a particular function, one error may override the other, which means the subordinate error does not get tested unless the other value is valid.
Defining Test Cases

Create test cases that incorporate each of the tests. For valid input, include as many tests as possible in one test case. For invalid input, include only one test in a test case in order to isolate the error. Only the invalid input test condition needs to be evaluated in such tests, because the valid condition has already been tested.

EXAMPLE OF EQUIVALENCE PARTITIONING

1. Conditions to be Tested

The following input conditions will be tested:
  • For the first three digits of all social insurance (security) numbers, the minimum number is 111 and the maximum number is 222.
  • For the fourth and fifth digits of all social insurance (security) numbers, the minimum number is 11 and the maximum number is 99.
2. Defining Tests

Identify the input conditions and uniquely identify each test, keeping in mind the items to consider when defining tests for valid and invalid data.

The tests for these conditions are:
  • The first three digits of the social insurance (security) number are:
  1. = or > 111 and = or <>
  2. <>
  3. > 222, (invalid input, above the range),
  4. blank, (invalid input, below the range, but may be treated differently).
  • The fourth and fifth digits of the social insurance (security) number are:
  1. = or > 11 and = or <>
  2. <>
  3. > 99, (invalid input, above the range),
  4. blank, (invalid input, below the range, but may be treated differently).
Using equivalence partitioning, only one value that represents each of the eight equivalence classes needs to be tested.

3. Defining Test Cases

After identifying the tests, create test cases to test each equivalence class, (i.e., tests 1 through 8).

Create one test case for the valid input conditions, (i.e., tests 1 and 5), because the two conditions will not affect each other.

Identify separate test cases for each invalid input, (i.e., tests 2 through 4 and tests 6 through 8).

Both conditions specified, (i.e., condition 1 - first three digits, condition 2 - fourth and fifth digits), apply to the social insurance (security) number.

Since equivalence partitioning is a type of black-box testing, the tester does not look at the code and, therefore, the manner in which the programmer has coded the error handling for the social insurance (security) number is not known. Separate tests are used for each invalid input, to avoid masking the result in the event one error takes priority over another.

For example, if only one error message is displayed at one time, and the error message for the first three digits takes priority, then testing invalid inputs for the first three digits and the fourth and fifth digits together, does not result in an error message for the fourth and fifth digits. In tests B through G, only the results for the invalid input need to be evaluated, because the valid input was tested in test case A.

4. Suggested test cases:
  1. Test Case A - Tests 1 and 5, (both are valid, therefore there is no problem with errors),
  2. Test Case B - Tests 2 and 5, (only the first one is invalid, therefore the correct error should be produced),
  3. Test Case C - Tests 3 and 5, (only the first one is invalid, therefore the correct error should be produced),
  4. Test Case D - Tests 4 and 5, (only the first one is invalid, therefore the correct error should be produced),
  5. Test Case E - Tests 1 and 6, (only the second one is invalid, therefore the correct error should be produced),
  6. Test Case F - Tests 1 and 7, (only the second one is invalid, therefore the correct error should be produced),
  7. Test Case G - Tests 1 and 8, (only the second one is invalid, therefore the correct error should be produced).

8 comments:

Sandy said...

Nice Blog

Makemoneykingdom.com said...

Superb blog.
Please can you add my website i.e http://www.makemoneykingdom.com in your favorite link.

Thanks

Anonymous said...

Good write-up. I certainly appreciate this site.

Thanks!
http://hen64.org/blogs/post/2851
http://www.aglea.com/modules.php?name=Your_Account&op=userinfo&username=AlysiaIvonne
Feel free to visit my web page :: bioethics

Anonymous said...

This article is genuinely a fastidious one it helps
new internet visitors, who are wishing in favor of blogging.


Have a look at my homepage ... best golf courses arizona

OffiDrivers said...

if there need software or driver visit here
Official Drivers Download Hp Printer
Official Drivers Download Samsung
Official Drivers Download Sony
<a href='http://www.offidrivers.ga" rel="nofollow">Official Drivers Download Toshiba</a>

OffiDrivers said...

asus a455l drivers

OffiDrivers said...

<a href='http://www.offidrivers.ga">Official Drivers Download Acer</a>

OffiDrivers said...

Official Drivers Download Acer