Table of Contents

About

A decision table is a language structure of Fitness that defines tests run and expectation.

Similar to Fit Column Fixture

See Basic test with a decision table

Example

|eg.Division                    |
|numerator|denominator|quotient?|
|10       |2          |5.0      |
|12.6     |3          |4.2      |
|22       |7          |~=3.14   |
|9        |3          |<5       |
|11       |2          |4<_<6    |
|100      |4          |33       |

where

  • eg.division is the fixture code where eg specifies a Java package (or other language namespace), and Division specifies the actual class to be called.
  • the rows are processed from left to right,
  • the input values are headers without a question mark ?
  • the input values are passed to the corresponding fields using setter functions
  • the expected value are the header with a question mark (ie quotient?) and can be expressed with operators:
    • ~=3.14 - approximately equal
    • <5 - less than
    • 4<_<6 - between

This decision table would test this Java class:

public class Division {
  private double numerator, denominator;
  
  public void setNumerator(double numerator) {
    this.numerator = numerator;
  }
  
  public void setDenominator(double denominator) {
    this.denominator = denominator;
  }
  
  public double quotient() {
    return numerator/denominator;
  }
}

Documentation / Reference