Chapter
This presentation is the property of its rightful owner.
Sponsored Links
1 / 31

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


  • 134 Views
  • Uploaded on
  • Presentation posted in: General

Chapter 3: Equivalence Class Testing :EC 322235 Software Testing. By Dr. Wararat Songpan ( Rungworawut ) Faculty of Computer Science, Department of Science, Khon Kaen University, Thailand. E quivalence C lass Testing : EC.

Download Presentation

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

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


By dr wararat songpan rungworawut faculty of computer science department of science

Chapter 3: Equivalence Class Testing :EC 322235Software Testing

By

Dr. WararatSongpan (Rungworawut)

Faculty of Computer Science,

Department of Science,

KhonKaen University, Thailand


E quivalence c lass testing ec

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.


By dr wararat songpan rungworawut faculty of computer science department of science

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


E quivalence c lass testing ec1

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 w eak n ormal testing wn

1) Weak Normal Testing :WN

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


For example addition x1 and x2 simple example

For example: Addition x1 and x2 (Simple example)

Function: Addition X1 and x2

x1

x2

Results =

Ok

Cancel


Simple example wn test case design

Simple example: WN Test case design

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


2 s trong n ormal testing sn

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

Simple example: SN Test case design

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


3 w eak r obust testing wr

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


Simple example wr test case design

Simple example: WR Test case design


4 s trong r obust t esting sr

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

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


Wn test case design triangle program simple

WN Test case design Triangle Program (Simple)

Valid EC

  • EC1: 1<=a<= 200

  • EC2: 1<=b<=200

  • EC3: 1<=c<=200


Sn test case design triangle program simple

SN Test case design Triangle Program (Simple)

Valid EC

  • EC1: 1<=a< 200

  • EC2: 1<=b<=200

  • EC3: 1<=c<=200


Equivalence class triangle problem output

Equivalence Class : Triangle Problem (Output)

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


Weak normal wn strong normal sn test cases triangle program

Weak Normal(WN)/ Strong Normal(SN) Test Cases: Triangle Program


Weak robust wr test cases triangle program

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


Weak robust wr test cases triangle program1

Weak Robust(WR) Test Cases: Triangle Program


Strong robust sr test cases triangle program

Strong Robust(SR) Test Cases: Triangle Program


Improved ec triangle program

Improved EC: Triangle Program

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


Equivalence classes ec nextdate problem

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}


Weak normal and strong normal test cases nextdate problem

Weak Normal and Strong Normal Test Cases: NextDate Problem


Weak robust test cases the nextdate problem

Weak Robust Test Cases: The NextDate Problem


Strong robust test cases the nextdate problem

Strong Robust Test Cases: The NextDate Problem


Improved input equivalence classes nextdate problem

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

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}


Strong robust test cases commission problem

Strong Robust Test Cases: Commission Problem


Using output to equivalence classes test cases commission problem

Usingoutput toEquivalence Classes Test Cases: Commission Problem

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


Specification of commision

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)


Summary of ec testing

Summary of EC Testing

Normal vs Robust

Single fault vs Multiple fault assumption


  • Login