content.txt
2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
!3 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''|
!3 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-!''][.FitLibraryUserGuide.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.''