Section 39.2. Calculator Runner


39.2. Calculator Runner

In this example, the test data is already in a textual form, and it is convenient to leave it in that form. However, it would be handy to be able to run the tests, using Fit, and to present the results as an HTML report along with a summary.

For our example, we will write a runner that will read in the test data from a file and create internal Fit tables. After running the tests in the tables, a report is written out in HTML, as usual.

The file data format is a sequence of comma-separated numbers, with three per line. Here's a sample:

1,

2,

3

4,

5,

9

7,

8,

15


The report we want will have two tables, as shown in Figure 39.1. In the first table, the calculated column returns the sum of a and b, using Sum, a ColumnFixture. So we need to generate the first two rows of the table in our runner, followed by a row for each line in our file. The second table simply consists of a single row for the fixture name, fit.Summary; extra rows are added in the report.

Figure 39.1. Fit Report for TestDiscount




    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