Loading in 2 Seconds...

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

Loading in 2 Seconds...

- By
**amal** - Follow User

- 198 Views
- Uploaded on

Download Presentation
## PowerPoint Slideshow about 'By Dr. Wararat Songpan ( Rungworawut ) Faculty of Computer Science, Department of Science,' - amal

**An Image/Link below is provided (as is) to download presentation**

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

Presentation Transcript

Chapter 3: Equivalence Class Testing :EC 322235Software Testing

By

Dr. WararatSongpan (Rungworawut)

Faculty of Computer Science,

Department of Science,

KhonKaen University, Thailand

EquivalenceClassTesting : EC

- 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=
- e=
- So, invalid valueforx1andx2as follows,
- x1 < a andx1>d
- x2
g

Remarks: [ = closed interval, ( = open interval

EquivalenceClassTesting : EC

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

1) Weak Normal Testing :WN

Valid EC:

Ec1 = {x1: a=

Ec2= {x1: b=

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

Ec4 = {x2: e =

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

Simple example: WN Test case design

x2

Valid EC:

Ec1 = {x1: 5=

Ec2= {x1: 10=

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

Ec4 = {x2: 5 =

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

20

10

5

x1

15

5

10

20

2) Strong Normal Testing : SN

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

Simple example: SN Test case design

x2

Valid EC:

Ec1 = {x1: 5=

Ec2= {x1: 10=

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

Ec4 = {x2: 5 =

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

20

10

5

x1

15

5

10

20

3) Weak Robust Testing (WR)

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

4) Strong Robust Testing :SR

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

Triangle Program (Simple)

- 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

Equivalence Class : Triangle Problem (Output)

- Using outputfrom specification translate into Equivalence Class(EC)
- 4possible outputs: Equilateral, Isosceles, Scalene, and Not a Triangle
- 4outputequivalence classes:

Weak Robust(WR) Test Cases: Triangle Program

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: Triangle Program

- Improved EC Input classes for each type of triangle:
- EC1 = {: a=b=c}
- EC2 = {: a=b, a ≠ c}
- EC3 = {: a=c, a ≠ b}
- EC4 = {: b=c, a ≠ b}
- EC5 = {:a ≠ b, a ≠ c, b ≠ c }
- Extra design of input classes: Check every side of triangle as not a triangle
- EC6 = {: b + c <= a}
- EC7 = {: a + c <= b}
- EC8 = {: a + b <= c}

Equivalence Classes(EC) : NextDate Problem

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

ImprovedInput Equivalence Classes: NextDate Problem

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

Input Equivalence Class: The Commission Problem

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}

Usingoutput toEquivalence Classes Test Cases: Commission Problem

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

- How to design WN Test Case??

Specification of Commision

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)

Download Presentation

Connecting to Server..