0% found this document useful (0 votes)
46 views

STM Unit4 DecisionTables

Decision table-based testing uses logical decisions to describe multiple scenarios and impossible combinations of input values. A decision table lists conditions, their possible values, and the corresponding actions. This guarantees complete testing by considering every combination of condition values. The table is used to identify test cases by treating conditions as inputs and actions as outputs.

Uploaded by

Guna Sekaran
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

STM Unit4 DecisionTables

Decision table-based testing uses logical decisions to describe multiple scenarios and impossible combinations of input values. A decision table lists conditions, their possible values, and the corresponding actions. This guarantees complete testing by considering every combination of condition values. The table is used to identify test cases by treating conditions as inputs and actions as outputs.

Uploaded by

Guna Sekaran
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 24

Decision Table-

based Testing
Decision Table-based testing
Uses logical decisions
Includes conditions and describes several different
scenarios
Describes impossible combinations of input values
May not be obvious for all problems

2
Decision Table
stub entries

conditions condition entries (rules)

actions action entries

3
Explanation
The top left portion of the table describes conditions
◦ One line per input variable
For each line in the top left portion, the top right
portion describes whether the condition is true or false
Each line in the bottom left portion describes an action
Each vertical column in bottom right portion indicates
what actions to be taken when the corresponding
conditions in the top right portion are matching

4
Decision Tables
A decision table guarantees a form of complete testing
◦ we consider every possible combination of condition values.
◦ Decision table is declarative

Limited entry decision table – all the conditions are binary


(true /false, yes/no, 0/1)
Extended entry decision table – conditions are allowed to
have several values.

5
Decision Table-based Testing
Identify test cases from decision table
◦ Consider conditions as input
◦ Consider actions as output
◦ Rules are test cases

6
Decision Tables
Don’t care entry
◦ Without don’t care entry, rule counts as 1
◦ With don’t care entry, double the rules.

7
Decision Tables
Complete the decision table:
Redundancy – remove the repetition
Consistency – when don’t care entry is used in the decision table and causes
the inconsistency, we should take care of the entry.

8
Develop a decision table
Decision tables provide a notation that translates conditions and actions
into a tabular form.
Steps to develop a decision table:
◦ List all actions that can be associated with a specific function (or module)
◦ List all conditions( or decisions made) during execution of the procedure
◦ Associate specific sets of conditions with specific actions, eliminating
impossible combinations; alternatively, develop every possible permutation
of conditions.
◦ Define rules by indicating what action(s) occurs for a set of conditions.

9
Advantages of Decision table method
Covers most of the possible cases
◦ Easy to visualize the completeness of the test cases

Describe logical relationships between inputs


◦ Something that is missing in boundary value analysis and equivalence
class testing
Possible to identify impossible combinations of inputs
◦ A column for which no action is specified

Possible to identify inconsistent combinations of inputs


◦ Two identical condition entries leading to different action entries

01/22/2024 10
Example
Example - login
User provides two inputs – username and password
Both inputs are validated for format and existence in the data store.

Action
 Invalid entry – may be incorrect format or the parameter does not exist
 Valid entry – the user is allowed to login
Conditions 1 2 3 4 5 6 7 8 9 1
0
1
1
1
2
1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
2
4
2
5
2
6
2
7
2
8
2
9
3
0
3
1
3
2

Username format T T T T T T T T T T T T T T T T F F F F F F F F F F F F F F F F
is correct
Username T T T T T T T T F F F F F F F F T T T T T T T T F F F F F F F F
matches with an
entry in data store
Password format T T T T F F F F T T T T F F F F T T T T F F F F T T T T F F F F
is correct
Password T T F F T T F F T T F F T T F F T T F F T T F F T T F F T T F F
matches with an
entry in data store
Username and T F T F T F T F T F T F T F T F T F T F T F T F T F T F T F T F
password both
match an entry in
data store
Actions

Login X

Error message X X X X X X X X X

Impossible X X X X X X X X X X X X X X X X X X X X X X

13
Another Example
Given three integers a, b and c representing the sides of a triangle, and the function

String typeOfTrinagle (int a, int b, int c)

that determines what type of triangle the inputs represent, generate test cases for the
function using decision table method. Notice that the three integers may not form a triangle.
Use the following conditions to determine whether or not they represent a triangle.

a + b > c AND b + c > a AND c + a > b

This example is given in Paul Jorgensen’s book.

14
Conditions 1 2 3 4 5 6 7 8 9 10 11

a < b + c? F T T T T T T T T T T
b < c + a? - F T T T T T T T T T
c < a + b? - - F T T T T T T T T
a = b? - - - T T T T F F F F
b = c? - - - T T F F T T F F
c = a? - - - T F T F T F T F
Actions
Not a triangle X X X
Scalene X
Isosceles X X X X
Equilateral X
Impossible X X X

‘-’ represents a DON’T CARE value for a condition

15
Generating test cases
• One test case per column in the truth table
• No test cases for “impossible” situations
• Every don’t care condition generates two test cases, one for ‘T’ and one for ‘F’
◦ Don’t care entry
◦ The condition is irrelevant
◦ The condition does not apply

• Total number of test cases will be less than or equal to the number of columns in the truth
table
• Make sure that all possible outcomes/actions are covered in the test cases

16
Test cases
Test case No. a b c Expected
output
1 10 5 5 Not a triangle
2 5 10 5 Not a triangle
3 5 5 10 Not a triangle
4 10 10 10 Equilateral
triangle or
isosceles
triangle
5 10 10 15 Isosceles
triangle
6 10 15 15 Isosceles
triangle
7 15 10 15 Isosceles
triangle
8 10 15 20 Scalene
triangle

17
Another example
Generate test cases for the following problem using
decision-table method:
◦ A student is required to take three exams, for course A, course B and a
practicum for course B (let us call it course C).
◦ The student will get a pass if he/she gets 50% or more in each of the
exams.
◦ The student will get a pass if he/she gets 50% or more in A and B, and
gets an average of 65% in B and C together.
◦ The student will get a pass if he/she gets an average of 75% in all the
three courses put together.
◦ The student will fail otherwise.

18
Conditions
Let A, B and C represent marks in courses A, B
and C respectively.
◦ There are five conditions:
◦ A >= 50
◦ B >= 50
◦ C >= 50
◦ (A+B)/2 >= 65
◦ (A+B+C)/3 >= 75

19
Actions
There are two possible actions
◦ Pass
◦ Fail
We also add one more action
◦ Impossible

20
Decision table
Conditions
A >= 50 T T T T T T T T T T T T T T T T
B >= 50 T T T T T T T T F F F F F F F F
C >= 50 T T T T F F F F T T T T F F F F
(B+C)/2 >= 65 T T F F T T F F T T F F T T F F

(A+B+C)/3 >= 75 T F T F T F T F T F T F T F T F

Actions
Pass x x x x x x x x x
Fail x x x x
Impossible x x x

21
Decision table (continued)
Conditions
A >= 50 F F F F F F F F F F F F F F F F
B >= 50 T T T T T T T T F F F F F F F F
C >= 50 T T T T F F F F T T T T F F F F
(B+C)/2 >= 65 T T F F T T F F T T F F T T F F

(A+B+C)/3 >= 75 T F T F T F T F T F T F T F T F

Actions
Pass x x
Fail x x x x x x x
Impossible x x x x x x x

22
Simplified Decision Table
Conditions
A >= 50 T T - T - F F F -
B >= 50 T T - T F - F - F
C >= 50 T - - - - - - F F
(B+C)/2 >= 65 - T - F - - - - -
(A+B+C)/3 >= 75 - - T F F F T T T
Actions
Pass x x x
Fail x x x
Impossible x x x

23
Limitation
Decision-table method is useful for those applications
that include several dependent relationships among the
input parameters. For simple data-oriented applications
that typically perform operations such as adding,
deleting and modifying entries, decision-table method
is not appropriate.

24

You might also like