This is narrative text explaining what the tests in this document are all about. We can write anything we want here; it's completely ignored by Fit itself.
com.tddinaction.fit.fixtures.CalculatorFixture | |||
left | right | operator | result() |
5 | 3 | + | 8 |
5 | 3 | - | 2 |
5 | 3 | * | 15 |
5 | 3 | / | 1.6666666666666667 |
The above table is a test interpreted by Fit according to the rules embedded into the header row cell values and the fixture class' inheritance hierarchy.
We can also include multiple test tables in a single document. In this case, we've used the same fixture class, but it could just as well be some other fixture.
com.tddinaction.fit.fixtures.CalculatorFixture | |||
left | right | operator | result() |
5 | 0 | * | 0 |
5 | 0 | / | error |
Fit will interpret and execute the tables it finds in a document in the order it encounters them.
We can also use RowFixtures to verify that the Calculator is recording a history of operations. This table verifies that the Calculator only remembers the five last operations (remember that we started with "5+3". That shouldn't be part of the rendered history because we've already performed five operations after that one):
com.tddinaction.fit.fixtures.CalculatorHistoryFixture | ||
left | operator | right |
5 | - | 3 |
5 | * | 3 |
5 | / | 3 |
5 | * | 0 |
5 | / | 0 |
In order to illustrate the use of the ActionFixture as well, consider the following table:
fit.ActionFixture | ||
start | com.tddinaction.fit.fixtures.CalculatorActionFixture | |
check | display | 0 |
enter | input | 1 |
check | display | 1 |
press | plus | |
check | display | 1 |
enter | input | 3 |
check | display | 3 |
press | equals | |
check | display | 4 |
That’s about it. Not too complex, right?