Cause-effect graphing is a test design technique used to derive test cases by modeling logical relationships between input conditions (causes) and system responses (effects).
How It Works
- Identify Causes and Effects
- Causes: Boolean input conditions (e.g.,
a = b
,a < b + c
) - Effects: System outputs or behaviours (e.g., “Isosceles”, “Not Triangle”)
- Causes: Boolean input conditions (e.g.,
- Draw a Boolean Graph
- Link causes to effects using logical connectors:
- AND: All connected causes must be true
- OR: At least one cause must be true
- Link causes to effects using logical connectors:
- Add Constraints
- Indicate impossible combinations (e.g., a triangle can’t have negative side lengths)
- Convert the Graph into a Decision Table
- Identify all cause combinations that lead to each effect.
- Each valid combination becomes a test case.
Example
You are testing a triangle classifier.
def triangle(a: int, b: int, c: int) -> str:
...
Identify causes and effects
Causes:
c1: a < b + c
c2: b < a + c
c3: c < a + b
c4: a = b
c5: a = c
c6: b = c
Effects: e1: “Not Triangle” — triangle inequality violated e2: “Scalene” — all sides different e3: “Isosceles” — two sides equal e4: “Equilateral” — all sides equal e5: “Impossible” — mutually exclusive constraints
Draw a boolean diagram
Convert graph into decision table
E1: Not triangle
Conditions | R1 | R2 | R3 |
---|---|---|---|
c1: a < b + c | F | T | T |
c2: b < a + c | - | F | T |
c3: c < a + b | - | - | F |
Output | |||
e1: Not Triangle | T | T | T |
E2: Scalene
Conditions | R8 |
---|---|
c1: a < b + c | T |
c2: b < a + c | T |
c3: c < a + b | T |
c4: a = b | F |
c5: a = c | F |
c6: b = c | F |
Output | |
e2: Scalene | T |
E3: Isosceles
Conditions | R5 | R6 | R7 |
---|---|---|---|
c1: a < b + c | T | T | T |
c2: b < a + c | T | T | T |
c3: c < a + b | T | T | T |
c4: a = b | T | F | F |
c5: a = c | F | T | F |
c6: b = c | F | F | T |
Output | |||
e3: Isosceles | T | T | T |
E4: Equilateral
Conditions | R4 |
---|---|
c1: a < b + c | T |
c2: b < a + c | T |
c3: c < a + b | T |
c4: a = b | T |
c5: a = c | T |
c6: b = c | T |
Output | |
e4: Equilateral | T |
Combined decision table
Conditions | R1 | R2 | R3 | R4 | R5 | R6 | R7 | R8 |
---|---|---|---|---|---|---|---|---|
c1: a < b + c | F | T | T | T | T | T | T | T |
c2: b < a + c | - | F | T | T | T | T | T | T |
c3: c < a + b | - | - | F | T | T | T | T | T |
c4: a = b | - | - | - | T | T | F | F | F |
c5: a = c | - | - | - | T | F | T | F | F |
c6: b = c | - | - | - | T | F | F | T | F |
Outputs | ||||||||
e1: Not Triangle | T | T | T | |||||
e2: Scalene | T | |||||||
e3: Isosceles | T | T | T | |||||
e4: Equilateral | T | |||||||
e5: Impossible |
Now, you can derive test cases based on the decision table as discussed in Decision Tables.
Back to parent page: Software Testing
Web_and_App_Development Software_Testing Blackbox_Testing SOFT3202 Decision_Table Cause_And_Effect_Graphing