Tutorial-13: To Generate Decision Table based Test Cases for a Payroll Problem
Objective of the Tutorial: To generate test cases for the payroll problem based upon decision table based testing technique
Consider the payroll system of a person
(a) If the salary of a person is less than equal to Rs. 70,000 and expenses do not exceed Rs. 30,000 then 10% tax is charged by IT department.
(b) If the salary is greater than Rs.60,000 and less than equal to Rs 2lakhs and expenses don’t exceed Rs. 40,000 than 20% tax is charged by IT department.
(c) For salary greater than Rs 2 lakhs, 5% additional surcharge is also charged. (d) If expenses are greater than Rs. 40,000 surcharge is 9%.
Step 1: First of all we need to identify the causes and its effects.
Causes |
Effects |
C1 : Salary < = 70,000
C2 : Salary > 60,000 and Salary < = 2 lacs C3 : Salary > 2 lacs C4 : Expenses < = 30,000 C5 : Expenses < = 40,000 C6 : Expenses > 40,000 |
E1 : 10% tax is charged.
E2 : 20% tax is charged. E3 : (20% tax) + (5% surcharge) is charged. E4 : (20% tax) + (9% surcharge) is charged. |
Step 2: Draw the following cause-effect graph
Step 3: Transform cause-effect graph into the following decision table. It may be noted that these ’causes’ and ‘effects’ are nothing else but ‘conditions’ and ‘actions’ of our decision table.
1 | 2 | 3 | 4 | ||
Condition / Cause | C1 | 1 | 0 | 0 | 0 |
Condition / Cause | C2 | 0 | 1 | 0 | 0 |
Condition / Cause | C3 | 0 | 0 | 1 | 1 |
Condition / Cause | C4 | 1 | 0 | 0 | 0 |
Condition / Cause | C5 | 0 | 1 | 1 | 0 |
Condition / Cause | C6 | 0 | 0 | 0 | 1 |
Action / Effect | E1 | X | – | – | – |
Action / Effect | E2 | – | X | – | – |
Action / Effect | E3 | – | – | X | – |
Action / Effect | E4 | – | – | – | X |
That is, if C1 and C4 are 1 (or true) then the effect (or action) is E1. Similarly, if C2 and C5 is 1 (or true), action to be taken is E2 and so on.
Step 4. Since there are 4 rules in our decision table above, so we must have at least 4 test cases to test this system using this technique.
These test cases can be
1. Salary = 20,000, Expenses = 2000.
2. Salary = 1,00,000, Expenses = 10,000
3. Salary = 3,00,000, Expenses = 20,000
4. Salary = 3,00,000, Expenses = 50,000.
Thus we can say that a decision table is used to derive the test cases which can also take into account the boundary values.
Many More Articles & Tutorials on Black Box Testing
An expert on R&D, Online Training and Publishing. He is M.Tech. (Honours) and is a part of the STG team since inception.
Hi!!!
You have given a gr8 collection of simple tutorias of Black Box Testing Thanx again
Sudhir
What is a lacs and what is a lakhs?