Presentation on theme: "Decision Table Based Testing"— Presentation transcript:
1Decision Table Based Testing Decision table is based on logical relationships just as the truth table.Decision Table is a tool that helps us look at the combination of conditionsCompleteness of conditionsInconsistency of conditions
2Components of a Decision Table rulesR1 R2 R3 R4 R5 R6 R7 R8T T T T F F F FC1C2C3values of conditions“binary”conditionsT T F F T T F FT F T F T F T Fa1a2a3a4a5x x x xx xactions takenx xactionsx x x xx xRead a Decision Table by columns of rules : (e.g. R1 from reqs. or design sayswhen all conditions are T, then actions a1, a2, and a5 should occur)
3Conditions in Decision Table 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.The decision table allows the iteration of all the combinations of values of the conditions, thus it provides a “completeness check.”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.How do you decide how many rules must exist use the permutations ofconditions and check against Requirements or Design Doc.?
4Conditions?While you get the conditions from the requirement statements or design statements, what exactly do you look for?Requirement/Design statement that talks about inputsRequirement/Design statement that talks about processingRequirement/Design statement that talks about outputsRequirement/Design statement that talks about criteria
5Triangle Problem Example (“short” form) Pick input set, <a, b, c>, for each of the columns, or rules, belowAssume a, b and c areall between 1 and 200R1R2R3R4R5R6R7R8R9R10R11a < b + cb < a + cc < a + ba = ba = cb = cF T T T T T T T T T T- F T T T T T T T T TF T T T T T T T TT T T T F F F FT T F F T T F FT F T F T F T FNot triangleScaleneIsoscelesEquilateral“impossible”X X XXX X XX X Xequivalent orall necessaryNote theImpossible casesReq or Design should NOThave these cases
6How Many Test Cases for Triangle Problem? There is the “invalid” situation --- Not a Triangle:There are 3 test conditions in the Decision tableNote the “-” entries, which represents “don’t care,” when it is determined that the input sides <a, b, c> do not form a triangleThere is the “valid” situation ---- A Triangle:There are 3 types of valid; so there are 23 = 8 test conditionsBut there are 3 “impossible” situationsSo there are only 8 – 3 = 5 test conditionsSo, for normal 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.Also, note that as we logically thought through this, it made us “look at’ theRequirement /Design statements more carefully.
7Calendar Next-Date Problem Example The Calendar next-date problem has many constraints, one of which deals with the value of the month:Condition 1 : 1 <= month <= 12Condition 2 : month < 1Condition 3 : month > 12Note we have not included the non-integer inputs here.
8A Decision Table for Next-Date Month inputCondition 1Condition 2Condition 3T T T T F F F FT T F F T T F FT F T F T F T FThere are 23 = 8 test conditions (8 columns) for the month value.But ---- are these really “independent” conditions? How are they dependent?
9Decision Table for Next-Date √√√Month inputR1 R2 R3 R4 R5 R6 R7 R8Remember :Condition 1: 1 < = m <= 12Condition 2: m < 1Condition 3: m > 12Condition 1Condition 2Condition 3T T T T F F F FT T F F T T F FT F T F T F T FNote 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 or 3, not both, can be true.So, rule R5 can be eliminated and we keep R6 and R7.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” ?! )
10Decision Table for Next-Date with Actions √√√Month inputR1 R2 R3 R4 R5 R6 R7 R8Remember :Condition 1: 1 < = m <= 12Condition 2: m < 1Condition 3: m > 12Condition 1Condition 2Condition 3T T T T F F F FT T F F T T F FT F T F T F T FAction 1Action 2X X X -X XAssume actions definedin the requirements doc.Note: that R3 has an action defined in the Decision Table. This should triggera question because the condition can not happen. There should be noaction defined for R perhaps, a Specification or Design error ?
11Advantages/Disadvantages of Decision Table Advantages: (check completeness & consistency)Allow us to start with a “complete” view, with no consideration of dependenceAllow us to look at and consider “dependence,” “impossible,” and “not relevant” situations and eliminate some test cases.Allow us to detect potential error in our SpecificationsDisadvantages:Need to decide (or know) what conditions are relevant for testing this may require Domain knowledgee.g. need to know leap year for “next date” problem in the bookScaling up can be massive: 2n rules for n conditions that’s if the conditions are binary and gets worse if the values are more than binary