Section 10.6. Ordered List Tables


10.6. Ordered List Tables

As we saw in Section 5.2 on p. 34, we can use RowFixture to test lists in which the order matters. We do this by including an extra column that gives the order of the rows.

Another approach is to use an ArrayFixture, which takes account of the order of the elements automatically. This is shown in the fourth table in Figure 10.5. The action ordered list selects an ArrayFixture, which checks that the expected and actual lists are the same, in the same order.

As with RowFixture, the header row labels four expected field values of each element in the list. Correct rows are colored green in the report.

Questions & Answers

Q1:

What if the elements are out of order?

A1:

The differences are marked in the report of the table. Quite how they are marked will depend on how closely they match.

Q2:

What if two rows in an ordered table are the same?

A2:

For the test to pass, there would need to be two matching rows in the same order in the actual list.



    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