1. Decision Table Based Testing <ul><li>Decision table is based on logical relationships just as the truth table. </li></ul><ul><li>Decision Table is a tool that helps us look at the combination of conditions </li></ul><ul><ul><li>Completeness of conditions </li></ul></ul><ul><ul><li>Inconsistency of conditions </li></ul></ul>
2. Components of a Decision Table C1 C2 C3 a1 a2 a3 a4 a5 T T T T F F F F T T F F T T F F T F T F T F T F x x x x x x x x x x x x x x conditions actions values of conditions actions taken R1 R2 R3 R4 R5 R6 R7 R8 rules Read a Decision Table by columns of rules : R1 says when all conditions are T, then actions a1, a2, and a5 occur
3. Conditions in Decision Table <ul><li>The conditions in the decision table may take on any number of values . When it is binary , then the decision table conditions are just like a truth table set of conditions. </li></ul><ul><li>The decision table allows the iteration of all the combinations of values of the condition, thus it provides a “completeness check.” </li></ul><ul><li>The conditions in the decision table may be interpreted as the inputs of the table , and the actions may be thought of as outputs of the table . </li></ul>How do you decide how many rules must exist ----- use this to check against Requirements Doc.?
4. Conditions? <ul><li>While you get the conditions from the requirement statements, what exactly do you look for? </li></ul><ul><ul><li>Requirement statement that talks about inputs </li></ul></ul><ul><ul><li>Requirement statement that talks about processing </li></ul></ul><ul><ul><li>Requirement statement that talks about outputs </li></ul></ul><ul><ul><li>Requirement statement that talks about criteria </li></ul></ul>
5. Triangle Problem Example (“short” form) <ul><li>a < b + c </li></ul><ul><li>b < a + c </li></ul><ul><li>c < a + b </li></ul><ul><li>a = b </li></ul><ul><li>a = c </li></ul><ul><li>b = c </li></ul><ul><li>Not triangle </li></ul><ul><li>Scalene </li></ul><ul><li>Isosceles </li></ul><ul><li>Equilateral </li></ul><ul><li>“ impossible” </li></ul>F T T T T T T T T T T - F T T T T T T T T T - - F T T T T T T T T - - - T T T T F F F F - - - T T F F T T F F - - - T F T F T F T F X X X X X X X X X X X Note the Impossible cases Pick input set, <a, b, c>, for each of the columns, or rules, below Assume a, b and c are all between 1 and 200 R1 R2 R3 R4 R5 R7 R6 R9 R8 R11 R10 Explain?
6. How Many Test Cases for Triangle Problem? <ul><li>There is the “invalid” situation --- Not a Triangle : </li></ul><ul><ul><li>There are 3 test conditions in the Decision table </li></ul></ul><ul><ul><li>Note the “-” entries, which represents “don’t care,” when it is determined that the input sides <a, b, c> do not form a triangle </li></ul></ul><ul><li>There is the “valid” situation ---- A Triangle : </li></ul><ul><ul><li>There are 3 types of valid; so there are 2 3 = 8 test conditions </li></ul></ul><ul><ul><li>But there are 3 “impossible” situations </li></ul></ul><ul><ul><li>So there are only 8 – 3 = 5 test conditions </li></ul></ul><ul><li>So, for valid values of a, b, and c, we need to come up with 8 sets of <a, b, c> to test the ( 3 + 5 ) = 8 test conditions . </li></ul>Also, note that as we logically thought through this, it made us “look at’ the Requirement statement s more carefully.
7. Calendar Next-Date Problem <ul><li>The Calendar next-date problem has many constraints, one of which deals with the value of the month: </li></ul><ul><ul><li>Condition 1 : 1 <= month <= 12 </li></ul></ul><ul><ul><li>Condition 2 : month < 1 </li></ul></ul><ul><ul><li>Condition 3 : month > 12 </li></ul></ul>
8. A Decision Table for Next-Date Condition 1 Condition 2 Condition 3 Month input T T T T F F F F T T F F T T F F T F T F T F T F There are 2 3 = 8 test conditions (8 columns) for the month value. But ------- are these really “independent” conditions ?
9. Decision Table for Next-Date Condition 1 Condition 2 Condition 3 Month input T T T T F F F F T T F F T T F F T F T F T F T F Remember : Condition 1: 1 < = m <= 12 Condition 2: m < 1 Condition 3: m > 12 R1 R2 R3 R4 R5 R6 R7 R8 Note that: a) If condition 1 is true, then conditions 2 and 3 must both be false. So Rules 1 – 4 is reduced to just R4. b) If condition 1 is false, then only one of the conditions 2 / 3, not both, can be true. So, rule R5 can be eliminated. c) Not all three conditions can be false. So rule R8 can be eliminated. That leaves only 3 conditions ---- R4, R6, and R7 (resembles “exclusive OR” ?! ) √ √ √
10. Decision Table for Next-Date with Actions Condition 1 Condition 2 Condition 3 Month input T T T T F F F F T T F F T T F F T F T F T F T F Remember : Condition 1: 1 < = m <= 12 Condition 2: m < 1 Condition 3: m > 12 R1 R2 R3 R4 R5 R6 R7 R8 √ √ √ Action 1 Action 2 - - - X - X X - - - X X - - - - Note that R3 has an action defined in the Decision Table. This should trigger a question because the condition can not happen. There should be no action defined for R3 ---- perhaps, a Specification error ? Assume actions defined in the requirements doc.
11. Advantages/Disadvantages of Decision Table <ul><li>Advantages: </li></ul><ul><ul><li>Allow us to start with a “complete” view, with no consideration of dependence </li></ul></ul><ul><ul><li>Allow us to look at and consider “dependence,” “impossible,” and “not relevant” situations and eliminate some test cases. </li></ul></ul><ul><ul><li>Allow us to detect potential error in our Specifications </li></ul></ul><ul><li>Disadvantages: </li></ul><ul><ul><li>Need to decide (or know) what conditions are relevant for testing - - - this may require Domain knowledge </li></ul></ul><ul><ul><ul><li>e.g. need to know leap year for “next date” problem in the book </li></ul></ul></ul><ul><ul><li>Scaling up can be massive: 2 n rules for n conditions - - - that’s if the conditions are binary </li></ul></ul>
Be the first to comment