A decision table is a structured way to represent combinations of input conditions and expected outputs in a tabular format. It helps:

  • Identify all relevant test scenarios
  • Ensure full logical coverage
  • Clarify the behaviour of the function based on multiple interacting inputs

Each column in the table (R1, R2, R3, etc.) represents a rule, i.e., a test case defined by a combination of input conditions and the resulting output.

Structure a decision table (Example)

The below function rejects non-positive side lengths (not a triangle) and classifies triangles as Equilateral, Isosceles, or Scalene.

def triangle(a: int, b: int, c: int) -> str:
    if a <= 0 or b <= 0 or c <= 0:
        return "Not Triangle"
    if a == b:
        if b == c:
            return "Equilateral"
        else:
            return "Isosceles"
    else:
        if b == c:
            return "Isosceles"
        else:
            return "Scalene"
 

Decision table

ConditionsR1R2R3*R4*R5R6*R7R8R9
i1: a,b,c form triangle?FTTTTTTTT
i2: a = b ?-TTTTFFFF
i3: a = c ?-TTFFTTFF
i4: b = c ?-TFTFTFTF
Outputs
O1: Not TriangleT
O2: ScaleneT
O3: IsoscelesTTT
O4: EquilateralT
O5: Impossible comboTTT

Test derivation

Each unique column (i.e a rule) becomes a test case. You can ignore any duplicate rules when producing test cases. The asterisks on R3*, R4*, R6* indicate they are the “Impossible” cases. When you design the test suite based on the decision table, these cases do not make it into the test suite.

triangle(-1,0,1) #R1
triangle(1,1,1)  #R2
triangle(1,1,2)  #R5
triangle(1,2,1)  #R7
triangle(2,1,1)  #R8
triangle(4,2,3)  #R9

Back to parent page: Software Testing

Web_and_App_Development Software_Testing Blackbox_Testing SOFT3202 Decision_Table