A useful testing technique and more… Decision Tables A useful testing technique and more… Marien de Wilde, Solution Architect
In this session … Definition Application areas Steps to create a decision table Exercise Solution to exercise February 2010
Definition Components A decision table lists causes and effects in a matrix. Each column represents a unique combination. Purpose is to structure logic Cause = condition Effect = action = expected results February 2010
Application Areas Business Analysis Programming Testing Hardware Design etc February 2010
Steps to Create a decision table List all causes in the decision table Calculate the number of possible combinations Fill columns with all possible combinations Reduce test combinations Check covered combinations Add effects to the table February 2010
Step 1: List all causes Hints: Write down the values the cause/condition can assume Cluster related causes Put the most dominating cause first Put multi valued causes last February 2010
Step 2: Calculate combinations If all causes are simply Y/N values: 2number of causes If 1 cause with 3 values and 3 with 2: 31 * 23 = 24 Or, use the Values column and multiply each value down the column, eg. 3*2*2*2=24 Number of Values to the power of the number of causes with these values February 2010
Step 3: Fill columns Algorithm: Determine Repeating Factor (RF): divide remaining combinations by the number of possible values for that cause Write RF times the first value, then RF times the next etc. until row is full Next row, go to 1. February 2010
Step 4: Reduce combinations Find indifferent combinations – place a ‘-’ Often there are dependencies between causes. For example cause 1 can test if a field is entered (Y/N) and cause 2 can test if the same field is valid (Y/N). It is no use testing if the field is valid if it has not been entered. Join columns: When in a column a cause is of no interest any more to determine the effects, a dash ‘-’ is placed in the column for that cause. This has to be done for both the column with a ‘Y’ and the column with a ‘N’. This makes the 2 columns identical and one of them can be deleted. Join columns where columns are identical Tip: ensure the effects are the same February 2010
Step 5: Check covered combinations Checksum For each column calculate the combinations it represents A ‘-’ represents as many combinations as the cause has Multiply for each ‘-’ down the column Add up total and compare with step 2 February 2010
Step 6: Add effects to table Read column by column and determine the effects One effect can occur in multiple test combinations February 2010
Exercise: Specification Create a decision table A mailing is to be sent out to customers. The content of the mailing is about the current level of discounting and potential levels of discounting. The content is different for different types of customers. Customer Types A, B and C get a normal letter except Customer Type C, who get a special letter. Any customer with 2 or more current lines or with a credit rating of ‘X’ get a special paragraph added with an offer to subscribe to another level of discounting. Ask questions from the analyst for clarification February 2010
Solution on next slide February 2010
Exercise: possible solution “2 or more current lines OR credit rating X”. What if both: AND? Other customer types? See “O-Other” above. What about non current lines? February 2010
Thank You February 2010