Search for:
Extract All requirement cases using Cause&Effect Analysis

Introduction

This article describes in detail an organized method to extract all possible cases from the requirement, this can help the system analyst in defining all the cases and also can help developers while preparing the unit TCs and of course will help the testers to write unified test cases.

First of all, suppose you have the following requirement:

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 gets a special letter. Any customer with 2 or more current lines or with a credit rating of ‘X’ gets a special paragraph added with an offer to subscribe to another level of discounting.

The problem is if you give this requirement to any 4 different testers, the 4 will produce different no of TCs, I will explain how to derive a unified number of TCs using cause and effect analysis and a decision table.

Step 1: Break the specification down to cause and effect:

First, the analyst must break down the requirement to causes and effects

– Cause: is a distinct input condition or an equivalence class of input conditions (the cause which triggers the effect) in our above example Customer Type (A, B, C, Other) is a cause

– Effect: is an output condition. Determine the logical relationship between the cause and the effects, in our above example “Get a normal letter” is an effect for the cause customer type(A, B,C, Other )
Usually, the effect is an output action (Ex. Error message, application action, executing specific application job, etc…)

After this step you should have causes and effects like that:

C1: Customer Type A, B, C, Other

C2: 2 or more lines

C3: Credit Rating

E1: Normal Letter

E2: Special Letter

E4: Add a special paragraph

E5: Get a Normal letter

Step 2: Put Causes and Effects in the decision Table.

Then we should fill the decision table by putting the cause and the effects together in that table as a following:

Cause\Effect
C1:
C2:
C3:
E1:
E2:
E3:
E4:
E5:

Step 3: Calculate all possible Combinations

This is a very important step to know no of columns in our decision table, simply use this formula to know all no of combinations that can occur:

• If all causes are simply Y/N values:
2number of causes

• If 1 cause with 3 values and 3 with 2:
31 * 23 = 24

In our example, C1 has 4 values (A or B or C or Other) AND C2 has 2 values (YES or NO) also C3 has 2 values (YES or NO) so our formula should be :

1* 2= 16 combinations

So we should draw for the decision table 16 columns which present 16 different combinations.

Now the table should be like that:

Cause\Effect
C1:
C2:
C3:
E1:
E2:
E3:
E4:
E5:

Step 4: Fill Columns

We can fill columns 2 methods:

1- Logical method: in this method, you start filling column by column, start with the causes and end up with the effect (put into consideration that every column is a case).

2- Repeating Factor Algorithm method:

a. Determine Repeating Factor (RF): divide remaining combinations by the number of possible values for that cause

b. Write RF times the first value, then RF times the next, etc. until the row is full

Example for using Repeating Factor Algorithm: suppose you have the following decision table:

12345678
C1(Y\N)
C2(Y\N)
C3(Y\N)
E1
E2

Fill first row: RF = number of remaining combination (8) / possible value for this

Cause (2) = (8/2 = 4), so we will fill 4 from Y and 4 of N, the DT will be :

12345678
C1(Y\N)YYYYNNNN
C2(Y\N)
C3(Y\N)
E1
E2

Fill Second row: RF = number of remaining combination (4) / possible value for this

Cause (2) = (4/2 = 2), so we will fill 2 from Y and 2 of N, the DT will be :

12345678
C1(Y\N)YYYYNNNN
C2(Y\N)YYNNYYNN
C3(Y\N)
E1
E2

Fill Third row: RF = number of the remaining combination (2) / possible value for this

Cause (2) = (2/2 = 1), so we will fill 1 from Y and 1 of N, the DT will be :

12345678
C1(Y\N)YYYYNNNN
C2(Y\N)YYNNYYNN
C3(Y\N)YNYNYNYN
E1
E2

Filing DT in example1:

In example 1 we have 3 causes and 5 effects with the total number of combinations = 16 combinations

Fill first row: RF = number of remaining combination (16) / possible value for this

Cause (4) = (16/4 = 4) , so we will fill 4 from every type (A,B,C,O) , the DT will be :

Cause\Effects
C1(A,B,C,O)AAAABBBBCCCCOOOO
C2(Yes\No)
C3(yes\No)
E1
E2
E3
E4
E5

Fill Second row: RF = number of remaining combination (2*2) / possible value for this

Cause (2) = (4/2 = 2), so we will fill 2 from every Y and 2 from N, the DT will be :

Cause\Effects12345678910111213141516
C1(A,B,C,O)AAAABBBBCCCCOOOO
C2(Yes\No)YYNNYYNNYYNNYYNN
C3(yes\No)
E1
E2
E3
E4
E5

Fill Third row: RF = number of the remaining combination (2) / possible value for this

Cause (2) = (2/2 = 1), so we will fill 1 from every Y and 1 from N, the DT will be :

Cause\Effects12345678910111213141516
C1(A,B,C,O)AAAABBBBCCCCOOOO
C2(Yes\No)YYNNYYNNYYNNYYNN
C3(yes\No)YNYNYNYNYNYNYNYN
E1
E2
E3
E4
E5

Step 5: Reduce Combinations

1- In our simple example find a don’t care “-” sign and place it,

12345678
C1(Y\N)YYYYNNNN
C2(Y\N)YYNNYYNN
C3(Y\N)YNYNYNYN
E1
E2

In the above DT suppose in column 3 and column 4, when the C2 become “N” the program end, so we will put in C3 the sign “-” which mean done care, the DT will become as follow :

12345678
C1(Y\N)YYYYNNNN
C2(Y\N)YYNNYYNN
C3(Y\N)YNYN
E1
E2

2- After placing the “-” don’t care sign, now remove the repeated columns, column 3 and 4 now become identical so will remove one of them, also column 7 and 8 now identical so I will remove one of them too, so the DT will be :

123568
C1(Y\N)YYYNNN
C2(Y\N)YYNYYN
C3(Y\N)YNYN
E1
E2

After removing the columns you must do a checksum for the table to assure that the DT still

cover all the original combination = 8

To do 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 the total and compare with step 2

So the checksum will be as follow:

123568
C1(Y\N)YYYNNN
C2(Y\N)YYNYYN
C3(Y\N)YNYN
E1
E2
Checksum1121128

Step 6: Add effects to table

• Read column by column and determine the effects

• One effect can occur in multiple test combinations

Cause\Effects12345678910111213141516
C1(A,B,C,O)AAAABBBBCCCCOOOO
C2(Yes\No)YYNNYYNNYYNNYYNN
C3(yes\No)YNYNYNYNYNYNYNYN
E1: Normal letterXXXXXXXX????
E2: Special LetterXXXX????
E3: Add paragraph?XX?XX?XX????
E4: No Letter
Checksum111111111111111116

As we see in the above table after adding effects to the table you can:

1- Determine if you have a missing requirement or not as in the case we place “?”, the requirement is missing if the customer type is other than the 3 types A, B,C

2- You can determine if there is a redundant requirement, example in columns 6 and 7 by looking into the table you will find the 2 columns have the same effects, so you can ask the client or the analyst about this situation and if it doesn’t matter to have a credit line or not in case of customer type B

3- Finally you will be sure that you cover all possible scenarios by doing this analysis.

Finally, In QLeaders we help you to analyze your requirement to ensure the maximum coverage of the requirement in the testing

QLeaders, Your Quality Gate!

Ahmed Ibrahim.