Section 28.3. Using SetFixture


28.3. Using SetFixture

Let's now consider the revised method usersInRoom() in Listing 28.4. This method instead makes use of SetFixture, a new fixture for testing unordered lists. This fixture reports in the same way as RowFixture but is more flexible. We can supply the actual collection as an argument to the constructor of SetFixture rather than having to subclass it.

SetFixture TReats a header label as the name of a property if there is no instance variable of that name. Hence, it will call the method getName() of User objects.

The interaction of the fixtures and the first five tables is illustrated in Figure 28.3. The collection supplied to the SetFixture object has a single User element.

Figure 28.3. TestDisconnect with SetFigure


If a method call for an action in a flow fixture object returns a Set, DoFixture automatically creates a SetFixture with it and returns that fixture. Hence, we can remove the method usersInRoom() in Listing 28.4. Then, when the action users in room is carried out, it leads to a call of the method usersInRoom() in the system under test. Because this returns a Set, DoFixture automatically creates a SetFixture, which is used to interpret the rest of the table.

Further details of SetFixture, and related list fixtures, are given in Section 28.9.



    Fit for Developing Software. Framework for Integrated Tests
    Fit for Developing Software: Framework for Integrated Tests
    ISBN: 0321269349
    EAN: 2147483647
    Year: 2005
    Pages: 331

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net