Cause-Effect Graph test technique

HARSHVARDHAN SINGH CHAUHAN
5 min readNov 12, 2021

Cause-Effect Graph falls under the black box testing technique which illustrates the relationship between the outcome and all the factors resulting into it. It is very important in the testing universe because it not only helps us in deriving the minimum number of possible test cases which can cover a maximum test area of the software but also helps us in identifying the gaps and ambiguities in the requirement specifications. If we realize that we are not able to derive a clear cause-effect graph then it means that there is a scope of improvement in the requirements. Cause-Effect Graph technique converts the requirements specification into a logical relationship between the input and the output conditions by using logical operators like AND, OR and NOT.

Before jumping into the steps to derive the graph, let us first understand what exactly a cause and effect is?

What is a Cause?

This is either a condition or set of conditions because of which either some change/transformation happens in the system or some output is generated.

What is an Effect?

An effect is nothing but either the output which is generated or system transformation which has occurred due to some inputs which are fed.

Now let us see how to we derive the graph step by step.

Step1:

The very first step is to identify the cause and effects from the specifications and assign unique numbers to each of them.

Step 2:

Draw a Boolean graph linking the cause and effects.

Step 3:

Specify the constraints on the graph describing the combinations of cause and/or effects that are impossible.

for eg: if x == y and x == z, then x == z or x will always be equal to y and there will not be any possibility of x not being equal to z.

Step 4:

Convert the graph into limited entry decision table by tracing state conditions in the graph. Limited entry decision table is a form of decision table where there are only two possible values for conditions which is nothing but Boolean value. This decision table shall be used to derive the final test cases. Here, each column will be translated into a test case.

Before deriving the graph, let us understand few notation that will be helpful. These notations can exist between either Cause and Effect, Cause and Cause or Effect and Effect. Below are some notations which exist between Cause and Effect.

  1. Identity Function:

It means that if C1 is true, then E1 will also be true. If C1 is false, then E1 will also be false. Both C1 and E1 will be identical in terms of Boolean value.

2. NOT Function:

It means if C1 exists or if C1 is true then E1 will cease to exist or E1 will be false. Although, if C1 is false then E1 will be true. In short, if the cause exists then the corresponding effect will not exist and vice versa.

3. OR Function:

Here there are three causes which are related to each other to derive a single effect. If any of the causes is true, then only the effect will be true or else it will be false.

4. AND Function:

If both the causes C1 and C2 are true then the effect E1 will be true or else the effect E1 will be false.

NOTE: In the first two functions (Identity and NOT) there is one to one mapping of cause and effect which means for one cause there will be one effect and we cannot have more then one causes for a single effect. However, in the case of OR and AND functions, we can have multiple causes combined to derive one effect.

Now, let us try to derive a graph for a problem. The problem is that there are two input values and one output value against each. The first value accepts only character and the character should be either A or B. The second value must be a digit. If the two values has above combination then the output printed is “MESSAGE 1”. If the character in the first value is incorrect, then the output printed is “INCORRECT VALUE 1”. If the character in the second value is not a digit, then the message printed is “INCORRECT VALUE 2”.

Let us try to derive the happy flows of causes and corresponding effect.

Causes are:

C1: Character for first value is A.

C2: Character for first value is B.

C3: Character for second value is a digit.

Effects are:

E1: Output is “MESSAGE 1”. → (C1 OR C2) AND C3.

E2: Output is “INCORRECT VALUE 1” → When first value has neither A nor B.

(NOT C1) AND (NOT C2) = NOT (C1 OR C2). Using De-Morgan’s law, NOT of individual causes with AND can be combined as combined NOT of OR of both the causes.

E3: Output is “INCORRECT VALUE 2”. When cause C3 is negated. NOT(C3).

If we try to derive the decision table with both positive and negative values the it would be something like this:

In the above decision table, each column represents a test case. The same can be derived into a easily understandable graph given below:

Here, the cause nodes are named and effect nodes are named but the intermediator nod is not required to be named.

We will discuss the constraints in detail in the next blog to understand better. Hope deriving the Cause-Effect graph is clear.

Cheers!

--

--

HARSHVARDHAN SINGH CHAUHAN

An avid reader, spoken word artist, dog lover, explorer, full stack qa engineer...