About
A fixture is a test class that test the system and that matches the expected format of test table.
In the example, it seems that Division is the class under test but class application are not so simple. Fixtures are just test and therefore should not contain any business logic.
The engine will:
- and pass the contents of the test table to the methods of the class.
Articles Related
Management
Search Path
The fixtures are searched in the search path that is created with the import table.
You need to use a classpath to specify the fixture code resides.
Develop
Shared state
Shared state between fixture:
- use of a static variable
Fitnesse test tables on a single page often need to share a common object.
Example
In the below 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 |
the fixture code is the class eg.Division.
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;
}
}