chapter 4: decision table testing 322235 software testing by dr. wararat songpan (rungworawut)...

49
Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon Kaen University, Thailand 1 322 235 กกกกกกกกกกกกกกกกก

Upload: rylee-larkins

Post on 14-Dec-2015

244 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Chapter 4: Decision Table Testing 322235 Software

Testing

ByDr. Wararat Songpan (Rungworawut)

Faculty of Computer Science, Department of Science,

Khon Kaen University, Thailand

1322 235 การทดสอบซอฟต์�แวร�

Page 2: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Decision Table Testing: DT• A decision table testing is basically an

outstanding technique used in both testing and requirements management. It is a structured exercise to prepare requirements when dealing with complex business rules. Also, used in model complicated logic.

• Also called Pairwise Testing, Classification-Trees Testing.

• Helps to test all different combination inputs with associated output.

• Contains CONDITIONs(Input) and ACTIONS(Output)

322 235 การทดสอบซอฟต์�แวร� 2

Page 3: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Decision Table Testing: DT

Log In Facebook example:

3

Email or Phone

Password

Expected Results

Page 4: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Decision Table Testing: DT

Log In Facebook example:

4

Email or Phone

F

Password F

Expected Results

Error:Incorrect Email

Page 5: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Decision Table Testing: DT

Log In Facebook example:

5

Email or Phone

F T

Password F F

Expected Results

Error:Incorrect Email

Error:Please ConfirmPassword

Page 6: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Decision Table Testing: DT

Log In Facebook example:

6

Email or Phone

F T F T

Password F F T T

Expected Results

Error:Incorrect Email

Error:Please ConfirmPassword

Error:Incorrect Email

Facebook Page is Processed

Page 7: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Decision Table Testing: DTA decision table has 4 portions:

1. Condition stub2. Condition entry3. Action stubs4. Action entry

322 235 การทดสอบซอฟต์�แวร� 7

Page 8: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Condition Entries• There are 2 type of condition entries:

• Condition entries binary values, they are called limited entry table.

• Condition entries have more than two values, they are called extended entry table.

322 235 การทดสอบซอฟต์�แวร� 8

Page 9: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Decision Table Testing: DT

Log In Facebook example:

9

Conditions Rule1 Rule2 Rule3 Rule4

Email or Phone

F T F T

Password F F T T

Expected Results

Error:Incorrect Email

Error:Please ConfirmPassword

Error:Incorrect Email

Facebook Page is Processed

Condition EntryCondition Stubs

Page 10: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Decision Table Testing: DT

Log In Facebook example:

10

Conditions Rule1 Rule2 Rule3 Rule4

Email or Phone

F T F T

Password F F T T

Expected Results

Error:Incorrect Email

Error:Please ConfirmPassword

Error:Incorrect Email

Facebook Page is Processed

Action EntryAction Stubs

Page 11: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Decision Table Testing: DT

Log In Facebook example:

11

Condition Rule1 Rule2 Rule3 Rule4

Email or Phone

F T F T

Password F F T T

Expected Results

Error:Incorrect Email

Error:Please ConfirmPassword

Error:Incorrect Email

Facebook Page is Processed

A rule = A test caseNo. of combination = No. of Condition1 value * No. of condition2 value = 2 * 2 = 4 rules or 4 test cases

Page 12: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Decision Table Testing: DT

Log In Facebook example:

12

Conditions Rule1 Rule2 Rule3 Rule4 Rule5 Rule6 Rule7 Rule8 Rule9

Email or Phone

Blank Blank Blank Invalid Invalid Invalid Valid Valid Valid

Password Blank Invalid Valid Blank Invalid Valid Blank Invalid Valid

Expected Results

Error:Incorrect Email

Error:Please ConfirmPassword

Error:Incorrect Email

Error:Incorrect Email

Error:Incorrect Email

Error:Incorrect Email

Error:Please ConfirmPassword

Error:Please ConfirmPassword

-

Show page Login Page

Login Page

Login Page

Login Page

Login Page

Login Page

Login Page

Login Page

Facebook Page

No. of combination = No. of Condition1 value * No. of condition2 value = 3 * 3 = 9 rules or 9 test cases

No. of Condition1 and 2 are blank, Invalid, valid as 3 possible values.

Page 13: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Decision Table Testing: DT

Library example:

13

Conditions Rule1 Rule2 Rule3 Rule4

Rule5

Rule6 Rule7 Rule8

User Registered?

F F F F T T T T

No Outstanding fees?

F F T T F F T T

Under Borrow limit?

F T F T F T F T

Borrow Book?

No No No No No No No Yes

No. of combination = No. of Condition1 value * No. of condition2 value * No. of Condition 3 value = 2 * 2 * 2 = 8 rules or 9 test cases

Page 14: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Decision Table Testing: DT

Library example:

14

Condition Rule1 Rule2 Rule3 Rule4

Rule5

Rule6 Rule7 Rule8

User Registered?

F F F F T T T T

No Outstanding fees?

F F T T F F T T

Under Borrow limit?

F T F T F T F T

Borrow Book?

No No No No No No No Yes

Page 15: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Decision Table Testing: DT

Library example:

15

Conditions Rule1,2

Rule3 Rule4

Rule5

Rule6 Rule7 Rule8

User Registered?

F F F T T T T

No Outstanding fees?

F T T F F T T

Under Borrow limit?

- F T F T F T

Borrow Book?

No No No No No No Yes

“-” or “?” means don’t care entry

Page 16: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Decision Table Testing: DT

Library example:

16

Conditions Rule1,2

Rule3 Rule4

Rule5

Rule6 Rule7 Rule8

User Registered?

F F F T T T T

No Outstanding fees?

F T T F F T T

Under Borrow limit?

- F T F T F T

Borrow Book?

No No No No No No Yes

Page 17: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Decision Table Testing: DT

Library example:

17

Conditions Rule1,2

Rule3,4

Rule5 Rule6 Rule7

Rule8

User Registered?

F F T T T T

No Outstanding fees?

F T F F T T

Under Borrow limit?

- - F T F T

Borrow Book? No No No No No Yes

Page 18: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Decision Table Testing: DT

Library example:

18

Conditions Rule1,2

Rule3,4

Rule5 Rule6 Rule7

Rule8

User Registered?

F F T T T T

No Outstanding fees?

F T F F T T

Under Borrow limit?

- - F T F T

Borrow Book? No No No No No Yes

Page 19: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Decision Table Testing: DT

Library example:

19

Conditions Rule1,2

Rule3,4

Rule5,6

Rule7 Rule8

User Registered?

F F T T T

No Outstanding fees?

F T F T T

Under Borrow limit?

- - - F T

Borrow Book? No No No No Yes

Page 20: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Decision Table Testing: DT

Library example:

20

Conditions Rule1,2

Rule3,4 Rule5,6

Rule7 Rule8

User Registered? F F T T T

No Outstanding fees?

F T F T T

Under Borrow limit?

- - - F T

Borrow Book? No No No No Yes

Page 21: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Decision Table Testing: DT

Library example:

21

Conditions Rule1-4 Rule5,6

Rule7 Rule8

User Registered?

F T T T

No Outstanding fees?

- F T T

Under Borrow limit?

- - F T

Borrow Book? No No No Yes

Page 22: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Condition stubs• We can apply Equivalence Partitioning and

Boundary Value Analysis techniques to only specific conditions or inputs.

• Although, if we have dissimilar inputs that result in different actions being taken or secondly we have a business rule to test that there are different combination of inputs which result in different actions. We use decision table to test these kinds of rules or logic.

• Tester can add more actions to show rules that are is impossible or not.

22

Page 23: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Decision Table Testing: DTTriangle example:

Conditions Rule 1 Rule 2

Rule 3

Rule 4

Rule 5

Rule 6 Rule 7

Rule 8 Rule 9

c1:a, b, c form of triangle?c2: a = b?c3: a = c?c4: b = c?

F

---

T

TTT

T

TTF

T

TFT

T

TFF

T

FTT

T

FTF

T

FFT

T

FFF

a1: Not a trianglea2: Scalenea3: Isoscelesa4: Equilaterala5: Impossible

x

xx x

x

x

x xx

322 235 การทดสอบซอฟต์�แวร� 23

Page 24: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Decision Table Testing: DTTriangle example (Refined):

Conditions Rule 1

Rule 2

Rule 3

Rule 4

Rule 5

Rule 6

Rule 7

Rule 8

Rule 9 Rule 10

Rule 11

c1:a < b + c ?c2: b< a + c ?c3: c < a + b ?c4: a = b?c5: a = c?c6: b = c?

F-----

TF----

TTF---

TTTTTT

TTTTTF

TTTTFT

TTTTFF

TTTFTT

TTTFTF

TTTFFT

TTTFFF

a1: Not a trianglea2: Scalenea3: Isoscelesa4: Equilaterala5: Impossible

x x x

xx x

x

x

x xx

322 235 การทดสอบซอฟต์�แวร� 24

Page 25: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Test case design from decision

table

Triangle Example:

322 235 การทดสอบซอฟต์�แวร� 25

Test Case ID a b c Expected Results

DT1 4 1 2 Not a Triangle

DT2 1 4 2 Not a Triangle

DT3 1 2 4 Not a Triangle

DT4 5 5 5 Equilateral

DT5 ? ? ? Impossible

DT6 ? ? ? Impossible

DT7 2 2 3 Isosceles

DT8 ? ? ? Impossible

DT9 2 3 2 Isosceles

DT10 3 2 2 Isosceles

DT11 2 4 5 Scalene

Page 26: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Decision Table Testing: DT

Triangle example (Refined) with rule

count:

Conditions Rule 1

Rule 2

Rule 3

Rule 4

Rule 5

Rule 6

Rule 7

Rule 8

Rule 9 Rule 10

Rule 11

c1:a < b + c ?c2: b< a + c ?c3: c < a + b ?c4: a = b?c5: a = c?c6: b = c?

F-----

TF----

TTF---

TTTTTT

TTTTTF

TTTTFT

TTTTFF

TTTFTT

TTTFTF

TTTFFT

TTTFFF

Rule count 32 16 8 1 1 1 1 1 1 1 1

a1: Not a trianglea2: Scalenea3: Isoscelesa4: Equilaterala5: Impossible

x x x

xx x

x

x

x xx

322 235 การทดสอบซอฟต์�แวร� 26

Page 27: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Rule count for mutually exclusive conditions

322 235 การทดสอบซอฟต์�แวร� 27

Conditions Rule 1 Rule 2 Rule 3

c1: month in M1 ?c2: month in M2 ?c3: month in M3 ?

T--

-T-

--T

Rule Count 4 4 4

a1a2a3

EC: M1 = {month: 1=<month<=12}M2 = {month: month <1}M3 = {month: month >12}

Page 28: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Expanded Version

Conditions 1.1 1.2 1.3 1.4 2.1 2.2 2.3 2.4 3.1 3.2 3.3 3.4

c1: month in M1?c2: month in M2?c3: month in M3?

TTT

TTF

TFT

TFF

TTT

TTF

FTT

FTF

TTT

TFT

FTT

FFT

Rule count 1 1 1 1 1 1 1 1 1 1 1 1

a1: impossiblea2:a3:

322 235 การทดสอบซอฟต์�แวร� 28

=12 rule counts

M1 = {month: 1=<month<=12}M2 = {month: month <1}M3 = {month: month >12}

Page 29: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Impossible Rules

Conditions 1.1 1.2 1.3 1.4 2.3 2.4 3.1 3.4

c1: month in M1?c2: month in M2?c3: month in M3?

TTT

TTF

TFT

TFF

FTT

FTF

TTT

FFT

Rule count 1 1 1 1 1 1 1 1

a1: impossiblea2:a3:

x x x x x

322 235 การทดสอบซอฟต์�แวร� 29

M1 = {month: 1=<month<=12}M2 = {month: month <1}M3 = {month: month >12}

Page 30: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Redundancy Rule in Decision Table

322 235 การทดสอบซอฟต์�แวร� 30

Conditions

Rule 1-4(1.1-1.4)

Rule 5 Rule 6 Rule 7 Rule 8 Rule 9

c1c2c3

T--

FTT

FTF

FFT

FFF

TFF

a1a2a3

x

x

xx

xxx

xx x

x

(An Inconsistent Decision Table)

Page 31: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Applied for EC in Decision Table

Testing

(First Try)• M1 = {month: month has 30 days}• M2 = {month: month has 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 = 2000}• Y2 = {year: year is leap year}• Y3 = {year: year is common year}

322 235 การทดสอบซอฟต์�แวร� 31

Page 32: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

1) Limited entry (1024 Rules)

Conditions

Ec1: month in M1?Ec2: month in M2?Ec3: month in M3?Ec4: day in D1?Ec5: day in D2?Ec6: day in D3?Ec7: day in D4?Ec8: year in Y1?Ec9: year in Y2?Ec10:year in Y3?

TT

T

a1: impossiblea2: next date

322 235 การทดสอบซอฟต์�แวร� 32

Page 33: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Applied for EC in Decision Table Testing

(Second Try)

• M1 = {month: month has 30 days}• M2 = {month: month has 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 = 2000}• Y2 = {year: year is leap year}• Y3 = {year: year is common year}

322 235 การทดสอบซอฟต์�แวร� 33

Page 34: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

2) Extended Entry (36 rules)

Conditions Rule 1 Rule 2 Rule 3 Rule 4 Rule 5 Rule 6 Rule 7 Rule 8 NextPage

->

c1: month inc2: day inc3: year in

M1D1-

M1D2-

M1D3-

M1D4-

M2D1-

M2D2-

M2D3-

M2D4-

Rule count 3 3 3 3 3 3 3 3

action

a1: impossiblea2: increment daya3: reset daya4: increment montha5: reset montha6: increment year

x xxx

xx x x

x???

322 235 การทดสอบซอฟต์�แวร� 34

Page 35: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

2) Extended Entry (36 rules) Cont.

Conditions Rule 9 Rule 10

Rule 11

Rule 12

Rule 13

Rule 14

Rule 15

Rule 16

Rule 17

c1: month inc2: day inc3: year in

M3D1Y1

M3D1Y2

M3D1Y3

M3D2Y1

M3D2Y2

M3D2Y3

M3D3-

M3D3-

M3D4-

Rule count 1 1 1 1 1 1 3 3 3

action

a1: impossiblea2: increment daya3: reset daya4: increment montha5: reset montha6: increment year

xx

xxx

xx

xx

x x x x

322 235 การทดสอบซอฟต์�แวร� 35

Page 36: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Applied for EC in Decision Table Testing

(Third Try)• M1 = {month: month has 30 days}• M2 = {month: month has 31 days except December}• M3 = {month: month = December}• M4 = {month: month = February}• D1 = {day: 1 =< day =< 27}• D2 = {day: day = 28}• D3 = {day: day = 29}• D4 = {day: day = 30}• D5 = {day: day = 31}• Y1 = {year: year is leap year}• Y2 = {year: year is common year}

322 235 การทดสอบซอฟต์�แวร� 36

Page 37: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

3) Decision Table (the third try)

Conditions 1 2 3 4 5 6 7 8 9 10 NextPage

->

c1: month inc2: day inc3: year in

M1D1-

M1D2-

M1D3-

M1D4-

M1D5-

M2D1-

M2D2-

M2D3-

M2D4-

M2D5-

Rule count

action

a1: impossiblea2: increment daya3: reset daya4: increment montha5: reset montha6: increment year

X X XXX

XX X X X

XX

322 235 การทดสอบซอฟต์�แวร� 37

Page 38: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

3) Decision Table (the third try)

(Cont.)

322 235 การทดสอบซอฟต์�แวร� 38

Conditions 11 12 13 14 15 16 17 18 19 20 21 22

c1: month inc2: day inc3: year in

M3D1-

M3D2-

M3D3-

M3D4-

M3D5-

M4D1-

M4D2Y1

M4D2Y2

M4D3Y1

M4D3Y2

M4D4-

M4D5-

Rule count

action

a1: impossiblea2: increment daya3: reset daya4: increment montha5: reset montha6: increment year

X X X XX

XX

X XXX

XX

X X X

Page 39: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Reduce redundancy rules

Conditions 1-3 4 5 6-9 10

c1: month inc2: day inc3: year in

M1D1, D2, D3

-

M1D4-

M1D5-

M2D1, D2, D3, D4

-

M2D5-

action

a1: impossiblea2: increment daya3: reset daya4: increment montha5: reset montha6: increment year

XXX

XX

XX

322 235 การทดสอบซอฟต์�แวร� 39

Page 40: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Reduce redundancy rules

322 235 การทดสอบซอฟต์�แวร� 40

Conditions 11-14 15 16 17 18 19 20 21-22

c1: month inc2: day inc3: year in

M3D1, D2, D3, D4

-

M3D5-

M4D1-

M4D2Y1

M4D2Y2

M4D3Y1

M4D3Y2

M4D4, D5

-

Rule count

action

a1: impossiblea2: increment daya3: reset daya4: increment montha5: reset montha6: increment year

XX

XX

X XXX

XX

X X

Page 41: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Test Cases designNext date example:

322 235 การทดสอบซอฟต์�แวร� 41

Test Case ID

Month Day Year Expected Results

1-3 April 15 2001 April 16, 2001

4 April 30 2001 May 1, 2001

5 April 31 2001 Impossible

6-9 January 15 2001 January 16, 2001

10 January 31 2001 February 1, 2001

11-14 December 15 2001 December 16, 2001

15 December 31 2001 January 1, 2002

16 February 15 2001 February 15, 2001

17 February 28 2004 February 29, 2004

18 February 28 2001 March 1, 2001

19 February 29 2004 March 1, 2004

20 February 29 2001 Impossible

21,22 February 30 2001 Impossible

=13 Test cases

Page 42: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

ATM (simple) Example

• Example scenario for an ATM where a decision table would be of use.

• A customer requests a cash withdrawal. One of the business rules for the ATM is that the ATM machine pays out the amount if the customer has sufficient funds in their account or if the customer has the credit granted. Already, this simple example of a business rule is quite complicated to describe in text. A decision table makes the same requirements clearer to understand:

322 235 การทดสอบซอฟต์�แวร� 42

Page 43: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

ATM (simple) Example

• Step 1 – Analyze the requirement and create the first column

• Requirement: “Withdrawal is granted if requested amount is covered by the balance or if the customer is granted credit to cover the withdrawal amount”.

322 235 การทดสอบซอฟต์�แวร� 43

Conditions

Withdrawal Amount <= Balance?

Credit Granted?

Actions

Withdrawal granted

Page 44: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

ATM (simple) Example

Conditions Rule1 Rule2 Rule3 Rule4

Withdrawal Amount <= Balance?

T T F F

Credit Granted? T F T F

Action count 1 1 1 1

Withdrawal granted

322 235 การทดสอบซอฟต์�แวร� 44

• Step 2 – Add column• Now is the time to fill in the T (TRUE) and F (FALSE) for the

conditions. How do you do that? The simplest is to say that it should look like this:

Page 45: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

ATM (simple) Example

Conditions Rule1 Rule2 Rule3 Rule4

Withdrawal Amount <= Balance?

T T F F

Credit Granted? T F T F

Action count 1 1 1 1

Withdrawal granted T T T F

322 235 การทดสอบซอฟต์�แวร� 45

• Step 3: Determine actions• Enter actions for each column in the table. You will

be able to find this information in the requirement.

Page 46: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

ATM (simple) Example

Conditions Rule1 Rule2 Rule3 Rule4

Withdrawal Amount <= Balance?

T T F F

Credit Granted? T F T F

Action count 1 1 1 1

Withdrawal granted T T T F

322 235 การทดสอบซอฟต์�แวร� 46

• Step 4 – Reduce the table• Mark insignificant values with “-”. If the requested amount is less than

or equal to the account balance it does not matter if credit is granted. In the next step, you can delete the columns that have become identical.

Page 47: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

ATM (simple) Example

Conditions Rule1,2 Rule3 Rule4

Withdrawal Amount <= Balance?

T F F

Credit Granted? - T F

Action count 2 1 1

Withdrawal granted T F F

322 235 การทดสอบซอฟต์�แวร� 47

• Step 4 – Reduce the table

Page 48: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

ATM (simple) Example

322 235 การทดสอบซอฟต์�แวร� 48

Test Case ID

Balance Withdrawal Amount

Credit Granted

Expected Results

1 200 200 200

2 100 200 Yes 200

3 100 200 No Withdrawal denied

• Step 5 – Write Test cases

Page 49: Chapter 4: Decision Table Testing 322235 Software Testing By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon

Advantage of decision table technique:

• Any complex business flow can be easily converted into the test scenarios & test cases using this technique.

• Such type of table are work iteratively, means the table created at the first iteration is used as input table for next tables. Such iteration can be carried out only if the initial table is unsatisfactory.

• Simple to understand and everyone can use this method design the test scenarios & test cases.

• It provide complete coverage of test cases which help to reduce the rework on writing test scenarios & test cases.

• These tables guarantee that we consider every possible combination of condition values. This is known as its “completeness property”.

322 235 การทดสอบซอฟต์�แวร� 49