Loading in 5 sec....

By Dr. Wararat Songpan ( Rungworawut ) Faculty of Computer Science, Department of Science,PowerPoint Presentation

By Dr. Wararat Songpan ( Rungworawut ) Faculty of Computer Science, Department of Science,

Download Presentation

By Dr. Wararat Songpan ( Rungworawut ) Faculty of Computer Science, Department of Science,

Loading in 2 Seconds...

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

By Dr. Wararat Songpan ( Rungworawut ) Faculty of Computer Science, Department of Science,

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 - - - - - - - - - - - - - - - - - - - - - - - - - -

Chapter 3: Equivalence Class Testing :EC 322235Software Testing

By

Dr. WararatSongpan (Rungworawut)

Faculty of Computer Science,

Department of Science,

KhonKaen University, Thailand

- The next step from Boundary Value Testing is a Functional Testing.
- Define equivalence classes on the range of input or output for each variables also called partition method.
- Completeness and greatly reduces redundancy.

EquivalenceClassTesting: EC

- Function F is implemented and a function F, of two variables x1 and x2.
- x1 and x2 have the following boundaries and intervals within boundaries:
- a=<x1=<dwith intervals [a,b), [b,c), [c,d]
- e=<x2=<g with intervals [e,f), [f,g]

- So, invalid valueforx1andx2as follows,
- x1 < a andx1>d
- x2 <e and x2>g
Remarks: [ = closed interval, ( = open interval

There are 4 sub-techniques of Equivalence Class Testing.

1) Weak Normal Testing :WN

2) Strong Normal Testing :SN

3) Weak Robust Testing :WR

4) Strong Robust Testing :SR

Valid EC:

Ec1 = {x1: a=<x1< b}

Ec2= {x1: b=<x1< c}

Ec3 = {x1: c <= x1 <= d}

Ec4 = {x2: e =<x2 < f}

Ec5 = {x2: f =< x2 <=g}

x2

g

f

e

x1

c

a

b

d

- One variable from each equivalence class as “single fault assumption”
- Values identified in systematic way

Function: Addition X1 and x2

x1

x2

Results =

Ok

Cancel

x2

Valid EC:

Ec1 = {x1: 5=<x1< 10}

Ec2= {x1: 10=<x1< 15}

Ec3 = {x1: 15 <= x1 <= 20}

Ec4 = {x2: 5 =<x2 <10}

Ec5 = {x2: 10=< x2 <=20}

20

10

5

x1

15

5

10

20

x2

- Test cases taken from each element of Cartesian product of the equivalence classes. Cartesian product guarantees notion of completeness.
- SN isa“multiple fault assumption”

g

f

e

x1

c

a

b

d

x2

Valid EC:

Ec1 = {x1: 5=<x1< 10}

Ec2= {x1: 10=<x1< 15}

Ec3 = {x1: 15 <= x1 <= 20}

Ec4 = {x2: 5 =<x2 <10}

Ec5 = {x2: 10=< x2 <=20}

20

10

5

x1

15

5

10

20

x2

Additional consider in Invalid EC:

Ec6 = {x1: x1 < a}

Ec7 = {x1: x1 > d}

Ec8 = {x2 : x2 < e}

Ec9 = {x2 : x2 > g}

- Robust - consideration of invalid values and extension to WN.
- Invalid inputs – each test case has one invalid value, single fault should cause failure as “single fault assumption”.
- Problems with robust EC Testing specification (expected output for invalid TC?)

g

f

e

x1

c

a

b

d

x2

- Robust - consideration of invalid values and extension to SN.
- Strong – multiple faults assumption.
- Test cases taken from each element of Cartesian product of the Valid EC and Invalid EC

g

f

e

x1

c

a

b

d

- Input 3 integers: a, b, c are side of triangle that have boundaries
- a, b, c are [1,200].
- Output is type of triangle
- Equilateral
- Isosceles
- Scalene
- Not a Triangle

Valid EC

- EC1: 1<=a<= 200
- EC2: 1<=b<=200
- EC3: 1<=c<=200

Valid EC

- EC1: 1<=a< 200
- EC2: 1<=b<=200
- EC3: 1<=c<=200

- Using outputfrom specification translate into Equivalence Class(EC)
- 4possible outputs: Equilateral, Isosceles, Scalene, and Not a Triangle
- 4outputequivalence classes:
- Ec1 = {<a,b,c> : the triangle with sides a, b and c is equilateral}
- Ec2 = {<a,b,c> : the triangle with sides a, b and c is Isosceles}
- Ec3 = {<a,b,c> : the triangle with sides a, b and c is Scalene) }
- Ec4 = {<a,b,c> : the triangle with sides a, b and c is Not a Triangle}

Consideration Invalid EC with WN

- EC5: a> 200
- EC6: a < 1
- EC7: b>200
- EC8: b < 1
- EC9: c>200
- EC10: c<1

- Improved EC Input classes for each type of triangle:
- EC1 = {<a, b, c>: a=b=c}
- EC2 = {<a, b, c>: a=b, a ≠ c}
- EC3 = {<a, b, c>: a=c, a ≠ b}
- EC4 = {<a, b, c>: b=c, a ≠ b}
- EC5 = {<a, b, c>:a ≠ b, a ≠ c, b ≠ c }

- Extra design of input classes: Check every side of triangle as not a triangle
- EC6 = {<a, b, c>: b + c <= a}
- EC7 = {<a, b, c>: a + c <= b}
- EC8 = {<a, b, c>: a + b <= c}

- Valid EC
- M1 = {month: 1 =< month =<12}
- D1 = {day: 1 =< day =< 31}
- Y1 = {year: 1812 =< year =< 2012}

- Invalid EC
- M2 = {month: month <1}
- M3 = {month: month >12}
- D2 = {day: day <1}
- D3 = {day: day >31}
- Y2 = {year: year < 1812}
- Y3 = {year: year > 2012}

- M1 = {month: monthhas 30days}
- M2 = {month: monthhas 31 days}
- M3 = {month: month = February}
- D1 = {day: 1 =< day =< 28}
- D2 = {day: day = 29}
- D3 = {day: day = 30}
- D4 = {day: day = 31}
- Y1 = {year: year is leap year}
- Y2= {year: year is common year }

Valid EC

- L1 = {lock: 1 =< locks =< 70}
- S1 = {stocks: 1=< stocks =< 80}
- B1 = {barrels: 1 =< barrels =< 90}
Invalid EC

- L2 = {locks: locks <1}
- L3 = {locks: locks > 70}
- S2 = {stocks: stocks < 1}
- S3 = {stocks: stocks > 80}
- B2 = {barrels: barrels <1}
- B3 = {barrels: barrels >90}

- Sales = 45 * locks +30 * stocks + 25 * barrels
- S1 = {<locks, stocks, barrels>: sales =<1000}
- S2 = {<locks, stocks, barrels>: 1000 < sales =<1800}
- S3 = {<locks, stocks, barrels>: sales > 1800 }

- How to design WN Test Case??

Sales = 45*Locks + 30*Stock + 25*barrels

if sales <= 1000

commission= 10% * sales

if sales >1000

commission= 10%*1000 + 15%*(sales– 1000)

if> 1800

commission= 10%*1000+ 15%*800+ 20%* (sales-1800)

Normal vs Robust

Single fault vs Multiple fault assumption