Equivalence partinioning and boundary value analysis

16
SUBMITTED TO:- MR.MOHIT SINGH CSE DEPARTMENT SUBMITTED BY:- NIHARIKA 2011BTCS006

Transcript of Equivalence partinioning and boundary value analysis

SUBMITTED TO:-

MR.MOHIT SINGH

CSE DEPARTMENT

SUBMITTED BY:-

NIHARIKA

2011BTCS006

The practice of testing software has become one

of the most important aspects of the process of

software creation. When we are testing software

the first and potentially most crucial step is to

design test cases.

MANY TEST CASES BEST TEST CASE

• BOUNDARY VALUE ANALYSIS and

EQUIVALENCE PARTIONIONING are

known as the best test cases.

• These are the type of black box testing

• It is very important to do both the tests together

to ensure an error free product.

EQUIVALENCE PARTIONING

• In this method the input domain data is divided

into different equivalence data classes. This

method is typically used to reduce the total

number of test cases to a finite set of testable test

cases, still covering maximum requirements.

• In short it is the process of taking all possible test

cases and placing them into classes. One test

value is picked from each class while testing.

CLASS A CLASS B CLASS C

1- 100 100-200 200-300

• Suppose the input domain for a function is 1 to 300.

• It is impossible to create 300 test cases .

• So we divide the input variables into classes.

• Then we select one value from each class.

• This one value will represent whole of the class

Now all of the input domain have been

categorized in their respective classes and one

variable has been chosen from each class.

BUT, it is a well known fact that error tend to

occur near the extremities of the input variable.

So, here comes the need for :-

BOUNDARY VALUE ANALYSIS

• Boundary value analysis focuses on the boundary ofthe input space to identify test cases.

• The rationale behind boundary value analysis is thaterrors tend to occur near the extreme values of aninput variable.

• Programs written in non-strongly typed languages aremore appropriate candidates for boundary valuetesting such as FORTRAN,COBOL.

7

BOUNDARY VALUE ANALYSIS

• Lets define two variables ,X1 and X2. Where X1

lies between A and B and X2 lies between C andD.

• A ≤ X1 ≤ B

• C ≤ X2≤ D

• The values of A, B, C and D are the extremitiesof the input domain. These are bestdemonstrated by the figure.

The yellow shaded area is the input domain.

The values used to test the extremities are:-

• Min ------------------------------------ - Minimal

• Min+ -----------------------Just above Minimal

• Nom ------------------------------------ - Average

• Max- ---------------------Just below Maximum

• Max ---------------------------------- Maximum

The green dots represent the boundary values.

Few examples to demonstrate the need for boundary value analysis.

• Programmer forgets to use <= instead use <.

• Programmer forgets to use count 0 while usingcounter variable.

• Next date problem.

• Triangle problem.

BVA is very useful in cases of future predictionof the test results of any product.

• The NextDate problem is a function of three variables: day,month and year. Upon the input of a certain date it returns thedate of the day after that of the input.

• The input variables have the obvious conditions:

• 1 ≤ Day ≤ 31.

• 1 ≤ month ≤ 12.

• 1812 ≤ Year ≤ 2012.

BVA is based on CRITICAL FAULT

ASSUMPTION

• The Critical Fault Assumption also known as the singlefault assumption in reliability theory. The assumption relieson the statistic that failures are only rarely the product oftwo or more simultaneous faults. Upon using thisassumption we can reduce the required calculationsdramatically.

• The function f that computes the number of test cases for agiven number of variables n can be shown as:

f = 4n + 1• As there are four extreme values this accounts for the 4n.

The addition of the constant one constitutes for the instancewhere all variables assume their nominal value.

LIMITATIONS OF BVA

• Boundary value analysis works well when theprogram to be tested is a function of severalindependent variables that represent bounded physicalquantities.

• Boundary value analysis selected test data with noconsideration of the function of the program, nor ofthe semantic meaning of the variables.

• We can distinguish between physical and logical typeof variables as well (e.g. temperature, pressure speed,or PIN numbers, telephone numbers etc.)

Hence, together boundary value analysis and equivalence

partitioning result in the best black box test case. The test case

values can be represented as:-

Class A Class Ba bm

The domain a to b is divided into two classes. Class A and B.

Boundary values are found in both the classes.