Actions and Methods
Each action in a DoFixture table is mapped directly to a method in the fixture (we'll expand this model in FixtureDetails).Eg, consider the first few tables:
- The fixture of the first table is a DoFixture, so the created flow fixture object handles the rest of the tables:
ChatStart |
- The second table contains an action, which is mapped into the method connectUser() of the (initial) flow fixture object, as shown below.
connect user | sarah |
- The third table contains two actions which are also applied to the flow fixture object.
user | sarah | creates | fit | room |
user | sarah | enters | fit | room |
Some Example Code
public class ChatStart extends fitlibrary.DoFixture {
private ChatRoom chat = new ChatRoom();
public ChatStart() {
setSystemUnderTest(chat);
}
public boolean connectUser(String userName) {
return chat.connectUser(userName);
}
public boolean userCreatesRoom(String userName, String roomName) {
return chat.userCreatesRoom(userName,roomName);
}
public boolean userEntersRoom(String userName, String roomName) {
return chat.userEntersRoom(userName,roomName);
}
...
The next table checks a list.
users in room | fit |
name | |
sarah |
The first row is an action, which corresponds to the method usersInRoom() which returns a ParamRowFixture[?]. This fixture object interprets the rest of the table.
...
public Fixture usersInRoom(String roomName) {
return new ParamRowFixture(chat.usersInRoom(roomName).toArray(),User.class);
}
...
Each following table is handled by the initial DoFixture:
connect user | rick |
This means that each table doesn't need an explicit fixture, so actions can be split up easily. Because actions may return a fixture object for the rest of the table, that object can be created with all the appropriate information. This avoids the needs for global variables for communication between fixtures.
FixtureDetails
- Copyright (c) 2004, 2005 Rick Mugridge, Rimu Research.
- Released under the terms of the GNU General Public License version 2 or later.
Add Child Page to WritingFixtures