This tutorial describes the ActionFixture element of the FIT framework. It is composed of the following sections:
| fit.Fixture | |
| ActionFixture | This page. Describes the basic functions of the fixture |
| TimedActionFixture | Describes how to test time dependent tasks. |
Basic Functionality of ActionFixture
ActionFixture allows us to check the results of a sequence of events. For example, lets write a test for a simple counter.
| fit.ActionFixture | ||
| start | fitnesse.fixtures.CountFixture | |
| check | counter | 0 |
| press | count | |
| check | counter | 1 |
| press | count | |
| check | counter | 2 |
| enter | counter | 5 |
| press | count | |
| check | counter | 6 |
The metaphor for this fixture is a simple control panel.
- You press buttons that have particular names.
- You enter values into registers that have certain names.
- You check the values of named meters.
Here is the code for the CountFixture:
public class CountFixture extends Fixture {
private int counter = 0;
public void count() {
counter++;
}
public int counter() {
return counter;
}
} As you can see the names of the buttons, registers and meters correspond directly to methods in the 'started' fixture. It's really as simple as that.
For more on ActionFixture see: TimedActionFixture.[UserGuide] [.FrontPage] [.RecentChanges]