Decision ables Wikipedia Decision ablebased esting Chapter A precise yet compact way to model complicated logic Associate conditions with actions to perform Can associate many independent conditions with several actions in an elegant way Decision able erminology Printer roubleshooting D Stub c c c a Rule Rule Rules, Rule Rule Rules, Conditions Actions Printer does not print A red light is flashing Printer is unrecognized Heck the power cable Check the printercomputer cable Ensure printer software is installed a Check/replace ink a Check for paper jam a Let s try this for the riangle problem riangle Decision able riangle est Cases C: a < b+c C: b < a+c C: c < a+b C: a = b C: a = c C: b = c A: ot a riangle A: Scalene A: A: Equilateral A: Case ID D D D D D D D D D D D a b c Expected Output ot a riangle ot a riangle ot a riangle Equilateral Scalene
extdate Decision able he extdate problem illustrates the problem of dependencies in the input domain Decision tables can highlight such dependencies dates can be clearly marked as a separate action Let s try it extdate Equivalence Classes M= {month month has days} M= {month month has days} M= {month month is ebruary} D= {day day } D= {day day = } D= {day day = } D= {day day=} = {year year = } = {year year is a leap year} = {year year is a common year} extdate D (st try partial) extdate D (nd try part ) C: month in M C: month in M C: month in M C: day in D C: day in D C: day in D C: day in D C: year in C: year in C: year in A: A: ext Date C: month in C: day in C: year in A: A: Increment day A: Reset day A: Increment month A: reset month M D M D M D M D M D M D M D M D extdate D (nd try part ) C: month in M M M M M M M M C: day in D D D D D D D D C: year in A: A: Increment day A: Reset day A: Increment month A: reset month ew Equivalence Classes M= {month month has days} M= {month month has days} M= {month month is December} M= {month month is ebruary} D= {day day } D= {day day = } D= {day day = } D= {day day = } D= {day day=} = {year year is a leap year} = {year year is a common year}
extdate D (rd try part ) extdate D (rd try part ) C: month in C: day in C: year in A: A: Increment day A: Reset day A: Increment month A: reset month M D M D M D M D M D M D M D M D M D M D C: month in C: day in C: year in A: A: Increment day A: Reset day A: Increment month A: reset month M D M D M D M D M D M D M D M D M D M D M D M D est Case Design o identify test cases with decision tables, we interpret conditions as inputs, and actions as outputs. Sometimes conditions end up referring to equivalence classes of inputs, and actions refer to major functional processing portions of the item being tested. he rules are then interpreted as test cases. Applicability he specification is given or can be converted to a decision table. he order in which the predicates are evaluated does not affect the interpretation of the rules or resulting action. he order of rule evaluation has no effect on resulting action. Once a rule is satisfied and the action selected, no other rule need be examined. he order of executing actions in a satisfied rule is of no consequence. Applicability Decision ables Issues he restrictions do not in reality eliminate many potential applications. In most applications, the order in which the predicates are evaluated is immaterial. Some specific ordering may be more efficient than some other but in general the ordering is not inherent in the program's logic. Before deriving test cases, ensure that he rules are complete Every combination of predicate truth values is explicit in the decision table he rules are consistent Every combination of predicate truth values results in only one action or set of actions
Guidelines and Observations Guidelines and Observations Decision able testing is most appropriate for programs where here is a lot of decision making here are important logical relationships among input variables here are calculations involving subsets of input variables here are cause and effect relationships between input and output here is complex computation logic (high cyclomatic complexity) Decision tables do not scale up very well May need to Use extended entry decision tables Algebraically simplify tables Decision tables can be iteratively refined he first attempt may be far from satisfactory Variable egation Strategy Example truth table An approach that can help with the scaling problems of decision tablebased testing Applicable when the system under test can be represented as a truth table (binary input and output) Designed to select a small subset of the test cases Variant umber ormal Pressure A Call or Heat B Damper Shut C Manual Mode D Ignition Enable Z Deriving the Logic unction Review boolean algebra AB = A and B A+B = A or B ~A = not A A logic function maps n boolean input variables to a boolean output variable A truth table is an enumeration of all possible input and output values Logic function he logic function for the example is Z = AB~C + AD Several techniques to derive it Karnaugh maps Causeeffect graphs A compact logic function will produce more powerful test cases
Variable egation Strategy egation variants Designed to reveal faults that hide in a don t care he test suite contains: Unique true points: A variant per term t, so that t is rue and all other terms are alse ear alse Points: A variant for each literal in a term. he variant is obtained by negating the literal and is selected only if it makes Z= Each variant creates a test candidate set Unique true point candidate sets in boiler example: {} {,,} Candidate set number erm negation ABC A~B~C ~AB~C A~D ~AD Variants containing this negation,,,,,,,,, Variants containing this negation where Z=,,,,,, Selecting the test cases At least one variant from each candidate set Can be done by inspection Random selection is also used ear alse Points exercise combinations of don t care values % of all possible tests are created % of simulated bugs can be found est suite Candidate sets,,,,,,,, Minimum est suite