Section 29.1. Business Forms


29.1. Business Forms

As we saw in Section 11.1 on p. 81, having a test that is similar in structure to a standard business form, such as an invoice, reduces the gap between the business world and the tests. Figure 29.1 shows again the example from Section 11.1.

Figure 29.1. A Table Corresponding to an Invoice


Part of the fixture class for this test is shown in Listing 29.1. This class is a subclass of TableFixture,[1] which calls the method doStaticTable() with the number of table rows to check the various cells of the table. The text in a table cell is accessed by row and column, using the TableFixture method getText(), as shown in both check() methods in Listing 29.1. The second check() method has to explicitly convert the text into a double, as there is no automatic type conversion.

[1] The class fitnesse.fixtures.TableFixture is supplied with FitNesse.

To provide feedback for the Fit report on whether a cell value is correct, the methods right() and wrong() are provided by class TableFixture. The methods take the position of the cell in the table; wrong() also takes the expected value, as a String.



    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