Fitnesse - Fixture

Fitnesse Architecture

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:

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;
  }
} 

Documentation / Reference





Discover More
Fitnesse Architecture
Fit - Column Fixture

ColumnFixture maps table columns directly to: properties, methods and fields of the fixture class. It is very useful for repetitive verification (as parameterized test) if the same test needs...
Fitnesse Architecture
Fit - Fixture

in Fit The first row of a FIT table is normally used to initialise the fixture class. In addition to that, you can pass arguments to the fixture by appending cells after the class name in that row....
Fitnesse Architecture
Fit - Import table

Import fixture package in order to write non fully qualified name. Generally found in SetUp pages for test suites. similar to
Fitnesse Architecture
Fit - Row Fixture

RowFixture tests dynamic lists of objects. It will compare the expected list (FitNesse table) with the actual result (from fixture code) and report any additional or missing items. similar to: ...
Fitnesse Architecture
Fitnesse - Engine (Test System)

Fitnesse has two test backend engine: slim (newer) or Fit (older) FitNesse submits the test table to the engine (test system) The engine looks for and runs the fixture code corresponding...
Fitnesse Architecture
Fitnesse - Fit Engine

Fit (“Framework for Integrated Testing”) is one of the two engine of fitnesse. The other one is called slim. It's a table-based...
Fitnesse Architecture
Fitnesse - Test Table

A table (test table) is the basic statement of Fitnesse in order to defined test. The format is table dependent but they generally take the basic form of: a constructor row (that defines the test...
Fitnesse Architecture
Slim - Decision Table (test case as a row)

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 where eg.division is the fixture...
Fitnesse Architecture
Slim - Import Table

Import statement for package to locate the class. It will add the packages to the fixture search path. Similar to the Example of import table where: fitnesse.slim.test refers to the following...



Share this page:
Follow us:
Task Runner