Sunday, January 18, 2009

Black Box - Equivalence Partitioning Technique


1)Equivalence partitioning

->"Equivalence partitioning is a black box testing method that divides the input domain of a program into classes of data from which test cases can be derived."
· Black-box technique that divides the input domain into classes of data from which test cases can be derived
· An ideal test case uncovers a class of errors that might require many arbitrary test cases to be executed before a general error is observed

EP can be defined according to the following guidelines:
1. If an input condition specifies a range, one valid and one two invalid classes are defined.
2. If an input condition requires a specific value, one valid and two invalid equivalence classes are defined.
3. If an input condition specifies a member of a set, one valid and one invalid equivalence class is defined.
4. If an input condition is Boolean, one valid and one invalid class is defined.

->Equivalence Partitioning
To reduce the number of test data
To select the right test cases to cover all possible scenarios
see above fig 1

now divided into 3 partitions (invalid partition1, valid partition, invalid partition2)
Test Data : 1 or 2 from each partition. In this ex. - -3, 4, 15

->Equivalence testing is normally used to check the type of the object.
Ex. A user ID text box has to accept alphabet characters ( a - z ) with length of 4 to 10 characters.
In +ve condition we have to test the object by giving alphabets. a-z char only, after that we need to check whether the object accepts the value, it will pass.
In -ve condition we have to test by giving other than alphabets (a-z) like A-Z, 0-9, blank etc it will fail.

->Black-Box Test Case Selection: Equivalence Partitioning

Because exhaustive black-box testing is infeasible, black-box test cases must be chosen to find different faults if possible.
We can usually assume that similar inputs will evoke similar responses, allowing us to group inputs into equivalence classes.
In equivalence partitioning, only one or a few test cases are chosen to represent an entire equivalence class.

Equivalence Classes

Input data should be divided into equivalence classes based on consideration of:
valid vs. invalid input values
valid vs. invalid output values
similarity and difference of input values
similarity and difference of output values
similarity and difference of expected processing

Examples of equivalence classes:

negative, positive, and 0 inputs or outputs;
input or output strings within size limits, beyond size limits, and the empty string;
input or output numeric values within size limits and beyond size limits;
input files that exist or not, are readable or not, are correct or not;
output files that exist or not, are writable or not;
combinations of input values that are consistent, and combinations that are not consistent.

Equivalence Partitioning Example

A graphing package displays lines with a standard weight, or eight alternate weights. Input data is a menu choice to change line weight.
The equivalence classes might be:
choosing the standard weight when the current weight is the standard weight
choosing the standard weight when the current weight is an alternate weight
choosing an alternate weight when the current weight is the standard weight
choosing an alternate weight when the current weight is an alternate weight

Equivalence class guidelines:
1. If input condition specifies a range, one valid and two invalid equivalence classes are defined
2. If an input condition requires a specific value, one valid and two invalid equivalence classes are defined
3. If an input condition specifies a member of a set, one valid and one invalid equivalence class is defined
4. If an input condition is Boolean, one valid and one invalid equivalence class is defined

No comments:

Post a Comment