Saturday 1 November 2014

Divide and Rule using ECP

Divide and Rule using ECP





Many a times we ask novice tester about applying Equivalence Class Partitioning  (ECP) technique, they mention it as ‘entering test data from valid class and invalid class’ or ‘dividing input range in multiple classes’ etc.
This explanation is not wrong but in many case, we do not get to understand the real meaning of ‘Equivalence Class’ with reference to testing.
So let’s first understand the equivalence class concept from mathematics.
Imagine that ‘S’ is a set of entities, say books.  Now we define a relationship for this set members as ‘has same author as’. Means, any 2 books ‘a’ and ‘b’ satisfy this relationship only if ‘a’ has same author as ‘b’.  Third book ‘c’ which has different author  than ‘a’ does not satisfy this relationship. Thus all entities from this set are divided in distinct classes, Class A- Author A, Class B – Author B etc.  There is no overlap between these classes. Such a relationship which divides a set in mutually exclusive classes is called equivalence relationship. The classes formed due to this relationship are called as equivalence classes. In this example, if the equivalence relation is ‘has same publisher as’ the number of classes created would be same as number of publishers applicable to this set .
Now interestingly, any member of the set is part of one and only one equivalence class with respect to the defined equivalence relationship. And union of all classes makes the original set.
How does it translate to us as testers?
In black box testing, we test the application by providing input and checking corresponding output. Input to the application can be anything, almost an infinite set of input values. But if we define an equivalence relation as ‘has the similar application behavior as’, then this set gets divided into distinct equivalence classes  which contain the values for which the application behavior is similar.
Consider example below where an application accepts exam marks and displays the grade for the student.




Set ‘X’ is almost infinite but after applying the equivalence relations, at the end we get four equivalence classes from an original set ‘X’ .  Any element of any of these classes would have same behavior defined by the equivalence relationship. Hence, all elements from one class are equivalent.  If we take one element from each class, we are actually ensuring that entire set is covered as union of these classes completes the entire input domain.
So during testing, we need to have test data which satisfies these equivalence relationships to simulate the application behavior. If this behavior is in line with the equivalence relationship then it indicates that the application works fine for all the classes and hence for entire input domain.
Also, as all values from any one class are equivalent, it is sufficient to take any one value from each of the equivalence class to check the application behavior .
So by using this ECP method, we get two advantages

  • We are sure that we have covered entire input domain
  • We have reduced test conditions from infinite to a manageable level without compromising the test coverage.
This is an extremely important concept as the test coverage and extent of testing is defined by the applicable equivalence classes.
So, divide the input domain in equivalent classes based on the equivalence relationship and start testing.


For more details visit SEED Infotech Wagholi Pune Blog at : http://seedinfotechpune.blogspot.in/

Locate us on Google Map : https://www.google.co.in/maps/place/SEED+Infotech+Pune/@18.580642,73.976231,15z/data=!4m2!3m1!1s0x0:0xc4d19be6006792c9?sa=X&ei=-dFUVMiFFcGLuwT6qIL4BA&ved=0CHwQ_BIwCg

For any enquiry leave your details here for call back : http://seedinfotechwagholi-pune.co.in/enquiry.php

Google+ : https://plus.google.com/+SeedinfotechwagholipuneCoIn412207/posts



No comments:

Post a Comment