# Chapter 4: Decision Table Testing Software Testing

## Presentation on theme: "Chapter 4: Decision Table Testing Software Testing"— Presentation transcript:

Chapter 4: Decision Table Testing 322235 Software Testing
By Dr. Wararat Songpan (Rungworawut) Faculty of Computer Science, Department of Science, Khon Kaen University, Thailand การทดสอบซอฟต์แวร์

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) การทดสอบซอฟต์แวร์

or Phone F Password Expected Results Error: Incorrect

Decision Table Testing: DT
A decision table has 4 portions: Condition stub Condition entry Action stubs Action entry การทดสอบซอฟต์แวร์

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. การทดสอบซอฟต์แวร์

Condition Entry Condition Stubs Conditions Rule1 Rule2 Rule3 Rule4 or Phone F T Password Expected Results Error: Incorrect Please Confirm Facebook Page is Processed

Conditions Rule1 Rule2 Rule3 Rule4 or Phone F T Password Expected Results Error: Incorrect Please Confirm Facebook Page is Processed Action Stubs Action Entry

Condition Rule1 Rule2 Rule3 Rule4 or Phone F T Password Expected Results Error: Incorrect Please Confirm Facebook Page is Processed A rule = A test case No. of combination = No. of Condition1 value * No. of condition2 value = 2 * 2 = 4 rules or 4 test cases

Conditions Rule1 Rule2 Rule3 Rule4 Rule5 Rule6 Rule7 Rule8 Rule9 or Phone Blank Invalid Valid Password Expected Results Error: Incorrect Please Confirm - Show 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.

Decision Table Testing: DT Library example:
Conditions Rule1 Rule2 Rule3 Rule4 Rule5 Rule6 Rule7 Rule8 User Registered? F T No Outstanding fees? Under Borrow limit? Borrow Book? 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

Decision Table Testing: DT Library example:
Condition Rule1 Rule2 Rule3 Rule4 Rule5 Rule6 Rule7 Rule8 User Registered? F T No Outstanding fees? Under Borrow limit? Borrow Book? No Yes

Decision Table Testing: DT Library example:
Conditions Rule1,2 Rule3 Rule4 Rule5 Rule6 Rule7 Rule8 User Registered? F T No Outstanding fees? Under Borrow limit? - Borrow Book? No Yes “-” or “?” means don’t care entry

Decision Table Testing: DT Library example:
Conditions Rule1,2 Rule3 Rule4 Rule5 Rule6 Rule7 Rule8 User Registered? F T No Outstanding fees? Under Borrow limit? - Borrow Book? No Yes

Decision Table Testing: DT Library example:
Conditions Rule1,2 Rule3,4 Rule5 Rule6 Rule7 Rule8 User Registered? F T No Outstanding fees? Under Borrow limit? - Borrow Book? No Yes

Decision Table Testing: DT Library example:
Conditions Rule1,2 Rule3,4 Rule5 Rule6 Rule7 Rule8 User Registered? F T No Outstanding fees? Under Borrow limit? - Borrow Book? No Yes

Decision Table Testing: DT Library example:
Conditions Rule1,2 Rule3,4 Rule5,6 Rule7 Rule8 User Registered? F T No Outstanding fees? Under Borrow limit? - Borrow Book? No Yes

Decision Table Testing: DT Library example:
Conditions Rule1,2 Rule3,4 Rule5,6 Rule7 Rule8 User Registered? F T No Outstanding fees? Under Borrow limit? - Borrow Book? No Yes

Decision Table Testing: DT Library example:
Conditions Rule1-4 Rule5,6 Rule7 Rule8 User Registered? F T No Outstanding fees? - Under Borrow limit? Borrow Book? No Yes

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.

Decision Table Testing: DT Triangle 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 a1: Not a triangle a2: Scalene a3: Isosceles a4: Equilateral a5: Impossible x การทดสอบซอฟต์แวร์

Decision Table Testing: DT Triangle 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 - T a1: Not a triangle a2: Scalene a3: Isosceles a4: Equilateral a5: Impossible x การทดสอบซอฟต์แวร์

Test case design from decision table Triangle Example:
Test Case ID a b c Expected Results DT1 4 1 2 Not a Triangle DT2 DT3 DT4 5 Equilateral DT5 ? Impossible DT6 DT7 3 Isosceles DT8 DT9 DT10 DT11 Scalene การทดสอบซอฟต์แวร์

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 - T Rule count 32 16 8 1 a1: Not a triangle a2: Scalene a3: Isosceles a4: Equilateral a5: Impossible x การทดสอบซอฟต์แวร์

Rule count for mutually exclusive conditions
M1 = {month: 1=<month<=12} M2 = {month: month <1} M3 = {month: month >12} Conditions Rule 1 Rule 2 Rule 3 c1: month in M1 ? c2: month in M2 ? c3: month in M3 ? T - Rule Count 4 a1 a2 a3 การทดสอบซอฟต์แวร์

Expanded Version =12 rule counts M1 = {month: 1=<month<=12}
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? T F F F Rule count 1 a1: impossible a2: a3: =12 rule counts M1 = {month: 1=<month<=12} M2 = {month: month <1} M3 = {month: month >12} การทดสอบซอฟต์แวร์

Impossible Rules M1 = {month: 1=<month<=12}
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? T F F F Rule count 1 a1: impossible a2: a3: x การทดสอบซอฟต์แวร์

Redundancy Rule in Decision Table
Conditions Rule 1-4 ( ) Rule 5 Rule 6 Rule 7 Rule 8 Rule 9 c1 c2 c3 T - F a1 a2 a3 x (An Inconsistent Decision Table) การทดสอบซอฟต์แวร์

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} การทดสอบซอฟต์แวร์

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? T a1: impossible a2: next date การทดสอบซอฟต์แวร์

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} การทดสอบซอฟต์แวร์

2) Extended Entry (36 rules)
Conditions Rule 1 Rule 2 Rule 3 Rule 4 Rule 5 Rule 6 Rule 7 Rule 8 Next Page -> c1: month in c2: day in c3: year in M1 D1 - D2 D3 D4 M2 Rule count 3 action a1: impossible a2: increment day a3: reset day a4: increment month a5: reset month a6: increment year x ? การทดสอบซอฟต์แวร์

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 in c2: day in c3: year in M3 D1 Y1 Y2 Y3 D2 D3 - D4 Rule count 1 3 action a1: impossible a2: increment day a3: reset day a4: increment month a5: reset month a6: increment year x การทดสอบซอฟต์แวร์

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} การทดสอบซอฟต์แวร์

3) Decision Table (the third try)
Conditions 1 2 3 4 5 6 7 8 9 10 Next Page -> c1: month in c2: day in c3: year in M1 D1 - D2 D3 D4 D5 M2 Rule count action a1: impossible a2: increment day a3: reset day a4: increment month a5: reset month a6: increment year X การทดสอบซอฟต์แวร์

3) Decision Table (the third try)(Cont.)
Conditions 11 12 13 14 15 16 17 18 19 20 21 22 c1: month in c2: day in c3: year in M3 D1 - D2 D3 D4 D5 M4 Y1 Y2 Rule count action a1: impossible a2: increment day a3: reset day a4: increment month a5: reset month a6: increment year X การทดสอบซอฟต์แวร์

Reduce redundancy rules
Conditions 1-3 4 5 6-9 10 c1: month in c2: day in c3: year in M1 D1, D2, D3 - D4 D5 M2 D1, D2, D3, D4 action a1: impossible a2: increment day a3: reset day a4: increment month a5: reset month a6: increment year X การทดสอบซอฟต์แวร์

Reduce redundancy rules
Conditions 11-14 15 16 17 18 19 20 21-22 c1: month in c2: day in c3: year in M3 D1, D2, D3, D4 - D5 M4 D1 D2 Y1 Y2 D3 D4, D5 Rule count action a1: impossible a2: increment day a3: reset day a4: increment month a5: reset month a6: increment year X การทดสอบซอฟต์แวร์

Test Cases design Next date example:
Test Case ID Month Day Year Expected Results 1-3 April 15 2001 April 16, 2001 4 30 May 1, 2001 5 31 Impossible 6-9 January January 16, 2001 10 February 1, 2001 11-14 December December 16, 2001 January 1, 2002 16 February February 15, 2001 17 28 2004 February 29, 2004 18 March 1, 2001 19 29 March 1, 2004 20 21,22 =13 Test cases การทดสอบซอฟต์แวร์

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: การทดสอบซอฟต์แวร์

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”. Conditions Withdrawal Amount <= Balance? Credit Granted? Actions Withdrawal granted การทดสอบซอฟต์แวร์

ATM (simple) Example 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: Conditions Rule1 Rule2 Rule3 Rule4 Withdrawal Amount <= Balance? T F Credit Granted? Action count 1 Withdrawal granted การทดสอบซอฟต์แวร์

ATM (simple) Example Step 3: Determine actions
Enter actions for each column in the table. You will be able to find this information in the requirement. Conditions Rule1 Rule2 Rule3 Rule4 Withdrawal Amount <= Balance? T F Credit Granted? Action count 1 Withdrawal granted การทดสอบซอฟต์แวร์

ATM (simple) Example 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. Conditions Rule1 Rule2 Rule3 Rule4 Withdrawal Amount <= Balance? T F Credit Granted? Action count 1 Withdrawal granted การทดสอบซอฟต์แวร์

ATM (simple) Example Step 4 – Reduce the table Conditions Rule1,2
Withdrawal Amount <= Balance? T F Credit Granted? - Action count 2 1 Withdrawal granted การทดสอบซอฟต์แวร์

ATM (simple) Example Step 5 – Write Test cases 1 200 2 100 Yes 3 No
Test Case ID Balance Withdrawal Amount Credit Granted Expected Results 1 200 2 100 Yes 3 No Withdrawal denied การทดสอบซอฟต์แวร์