- 213 Views
- Uploaded on
- Presentation posted in: General

Overview

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

ECE 453 – CS 447 – SE 465 Software Testing & Quality AssuranceLecture 6InstructorPaulo Alencar

- Functional Testing
- Boundary Value Testing (BVT)
- Boundary Value Analysis
- Robustness Testing
- (Robust) Worst Case Testing
- Special Value Testing

- Equivalence Class Testing
- Weak Equivalence Class Testing
- Strong Equivalence Class Testing
- Traditional Equivalence Class testing

- Decision Table Based testing

- Boundary Value Testing (BVT)

- The use of equivalence class testing has two motivations:
- Sense of complete testing
- Avoid redundancy

- Equivalence classes form a partition of a set that is a collection of mutually disjoint subsets whose union is the entire set.
- Two important implications for testing:
- The fact that the entire set is represented provides a form of completeness
- The disjointness assures a form of non-redundancy

- The idea of equivalence class testing is to identify test cases by using one element from each equivalence class.
- If the equivalence classes are chosen wisely this greatly reduces the potential redundancy among test cases.
- The key point in equivalence class testing is the choice of the equivalence relation that determines the classes (partitions).
- We will differentiate below, between weak and strong equivalence class testing.

- It tends to be a “craft”:
- no dependence on knowledge of code, only the specification
- needs knowledge of input domain that usually goes beyond what an interface design specification provides
- familiarity with specifications

- Let us consider a program P with 3 inputs: a, b and c and the corresponding input domains are A, B, and C.
- define the partition:

A = A1 U A2 U A3

B = B1 U B2 U B3 U B4

C = C1 U C2

- define a1, a2 and a3 as:
- let ai be a “representative” or “typical” value within its respective equivalence class (e.g. the midpoint in a linear equivalence class).
- similarly define bi and ci.

- test cases can be stated for the inputs <a,b,c> in terms of the representative points.
- the basic idea behind the techniques is that one point within an equivalence class is just as good as any other point within the same class.

- Weak equivalence class testing is accomplished by using one variable from each equivalence class in a test case.
- The minimum number of test cases is equal to the number of classes in the partition with the largest number of subsets.
- From the previous example, we have:

- Strong equivalence class testing is based on the Cartesian Product of the partition subsets.
- From the previous example, this would generate:
3 * 4 * 2 = 24 test cases

- Generates more test cases which test for any interaction between the representative values from each of the subsets.
- For either method, it may be possible to define equivalence relations for the program output, then test cases can also be based on these.

- The traditional view of equivalence class testing defines equivalence in terms of validity that is, test cases determined from the valid and invalid values for each input variable.
- For each input variable there are valid and invalid values.
- In the traditional approach, these are identified and numbered, and then incorporated into test cases in the weak sense as presented above.

- Given valid and invalid sets of inputs, the traditional equivalence testing strategy identifies test cases as follows:
- For valid inputs, use one value from each valid class (as in what we have called weak equivalence class testing). In this context, each input in these test cases will be valid.
- For invalid inputs, a test case will have one invalid value and the remaining values will be valid. In this context, a “single failure” should cause the test case to fail.

- If the input variables have defined ranges, then the test cases from traditional equivalence class testing will always be a subset of those that would be generated by robustness testing.

- There are two problems with the traditional equivalence testing:
- The first is that, very often, the specification does not define what the expected value for an invalid test case should be.
- The second problem is that strongly typed languages eliminate the need for the consideration of invalid inputs.

- For example consider a program with two input variables size and weight:
- valid ranges:
S1: 0 < size < 200

W1: 0 < weight < 1500

- corresponding invalid ranges might be:

- valid ranges:

- In the problem statement we note that there are four possible outputs:
- Not a Triangle
- Isosceles
- Equilateral
- Scalene

- We can use these to identify output (range) equivalence classes:
R1= {<a, b, c> | the triangle with sides a, b, c, is equilateral}

R2= {<a, b, c> | the triangle with sides a, b, c, is isosceles}

R3= {< a, b, c> | the triangle with sides a, b, c, is scalene}

R4= {a, b, c> | sides a, b, c do not form a triangle}

- These classes yield the following simple set of test cases:

- If we base the equivalence classes on the input domain, we will obtain a larger set of test cases. We can define the sets:
D1= {<a,b,c> | a=b=c}

D2= {<a,b,c> | a=b, a≠c}

D3= {<a,b,c> | a=c, a≠b}

D4= {<a,b,c> | b=c, a≠b}

D5= {<a,b,c> | a≠b, a≠c, b≠c}

- As a separate property we can apply the triangle property to see even if the input constitutes a triangle
D6= {<a, b, c> | a ≥ b+c}

D7= {<a, b, c> | b ≥ a+c}

D8= {<a, b, c> | c ≥ a+b}

- If we wanted also we could split D6 into
D6’={<a, b, c> | a = b+c} and

D6’’= {<a, b, c> | a > b+c}

- Nextdate is a function of three variables, month, day, and year and these have ranges defined as:
1 ≤ month ≤ 12

1 ≤ day ≤ 31

1812 ≤ year ≤ 2012

- We will examine below the valid, invalid equivalence classes, strong, and weak equivalence class testing.

- The valid equivalence classes are:
M1= {month | 1 ≤ month ≤ 12}

D1= {day | 1 ≤ day ≤ 31}

Y1= {year | 1812 ≤ year ≤ 2012}

The invalid equivalence classes are:

M2= {month | month < 1}

M3= {month | month > 12}

D2= {day | day < 1}

D3= {day | day > 31}

Y2= {year | year < 1812}

Y3= {year | year > 2012}

These classes yield the following test cases, where the valid inputs are mechanically selected from the approximate middle of the valid range:

- If we more carefully chose the equivalence relation, the resulting equivalence classes will be more useful
M1= {month | month has 30 days}

M2= {month | month has 31 days}

M3= {month | month is February}

D1= {day | 1 ≤ day ≤ 28}

D2= {day | day = 29}

D3= {day | day = 30}

D4= {day | day=31}

Y1= {year | year = 1900}

Y2= {year | 1812 ≤ year ≤ 2012 AND year ≠ 1900 AND (0 = year mod 4}

Y3= {year | 1812 ≤ year ≤ 2012 AND 0 ≠ year mod 4}

- The traditional form of equivalence testing is generally not as thorough as weak equivalence testing, and in its turn, not as thorough as strong equivalence testing
- If error conditions is a priority we can extend strong equivalence testing to include invalid classes
- Equivalence class testing is appropriate when input data is defined in terms of ranges and sets of discrete values.
- Logic of functionality of the program can help define the equivalence classes
- Strong equivalence takes the presumption that variables are independent, otherwise it generates some “error” test cases
- Can be strengthened by using it with domain testing (boundary value):
- Reuse the work to define the ranges
- Does not consider elements at equivalence class boundaries
- Need to expand ECT to include BVT-like requirements (domain testing)