Fitnesse - Test Table

Fitnesse Architecture

About

A table (test table) is the basic statement of Fitnesse in order to defined test.

Format

The format is table dependent but they generally take the basic form of:

  • a constructor row (that defines the test class and the constructor argument)
  • a mapping row that define the data type (input or output) and maps the data to the method to be called
  • data rows that have some input, parameter cells which are followed by some Output cells.

This example from the getting started, a slim decision table:

|eg.Division                    | <-- The test class (Fixture)
|numerator|denominator|quotient?| <-- The method called (without ?, this is setter function, with a ?, the function returns value)
|10       |2          |5.0      | <-- The first row of data to set and to expect
|12.6     |3          |4.2      | <-- The second row of data to set and to expect
|22       |7          |~=3.14   |
|9        |3          |<5       |
|11       |2          |4<_<6    |
|100      |4          |33       |

where:

  • The vertical bars delimit table cells (tables are written by separating cells with the pipe symbol)
  • If you change “eg.Division” to any other name, you may need to add exclamation mark ! before. It is optional, and tells FitNesse not to apply any smart formatting to table contents (ie to avoid confusing FitNesse with WikiWords)
  • The fixture is the Java (or some other supported language) class that the engine will call to process the contents of the table.
  • eg.Division is the class to test 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

After running the test:

  • In the green cells, we got back the expected values from our code.
  • A cell turns red when we get back a different value than what we expected. We also see two values: the expected value and the actual value.
  • A yellow cell, if an exception was thrown

List

Management

Creation

  • Manually
  • or Spreadsheet to Fitnesse.
    • copy the Excel table to the clipboard,
    • use the Spreadsheet to Fitnesse button on the Edit page

Constructor

ConstructorArguments

|Decision:my decision table|constructor argument 1|constructor argument 2|
|...|

Documentation / Reference





Discover More
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 - Fixture

A fixture is a test class that test the system and that matches the expected format of test table. Division The engine will: call it and pass the contents of the test table to the methods of the...
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 - Script Table (Multi-pass Test)

A script table is a series of actions and checks. Similar to the fit Do Fixture. A script table is a suite of methods call where the following built-in methods can be used: check, - the method returns...
Fitnesse Architecture
Test - Fitnesse Framework

Fitnesse is test framework based on two components: The front-end, a wiki of a page and as two backend engine that runs wiki page marked as test page slim or Fit The tests are written in a...



Share this page:
Follow us:
Task Runner