Section 10.3. Actions on Domain Objects with DoFixture


10.3. Actions on Domain Objects with DoFixture

As we've seen, the chat application has users and rooms, or what are called the domain objects of this system. Actions are carried out on those objects, such as when a user enters a room, as in the fourth table of Figure 10.1.

A DoFixture table may carry out a sequence of actions on a particular domain object that is selected from the system under test.[1] For example, the second table in Figure 10.3 includes an alternative approach to the user connecting, creating a room, and entering it. Rather than including the user name in each action, we have the first row, the connect action, provide access to the user, using another DoFixture. The rest of the rows of that table contain actions that apply to that user.

[1] This is an advanced topic, which you may like to ignore for now.

Figure 10.3. TestUser


The third table in Figure 10.3 acts on the room that is selected in the first row. The second row of that table checks the owner of the roomthe user who created itand the third row action renames the room.

In general, if a row selects an object through a DoFixture, the actions in the rest of the table apply to that object. This is similar to the way that RowFixture treats the remaining rows of the table as expected elements.

Questions & Answers

Q1:

Can any row select an object?

A1:

Yes. So we could select a room in one row of a table, then select the owner of that room in a later row of the same table, and then act on that user.



    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