37.1. Running Fit We'll get into the architecture of Fit by looking at what happens, step by step, when we use a FileRunner to run a table from an HTML file, as we saw in Chapter 26. The file contains only the TestOccupants table in HTML, as shown in Figure 37.1. Figure 37.1. Fit Table for Testing OccupantsOccupantList | user | login time | entry time | anna | 15:45 | 15:48 | luke | 16:03 | 17:14 |
Figure 37.2 summarizes the following steps in running the table in Figure 37.1: A FileRunner object (FileRunner#1) uses a Parse to read the HTML from the file and create a tree of Parse objects (Parse#1). FileRunner#1 passes Parse#1 to the method doTables() of a new object of class Fixture that it creates, Fixture#1. Fixture#1 gets the name of the fixture from the first row of the table: TestOccupants, a subclass of ColumnFixture. The fixture creates TestOccupants#1, an object of that class, and calls its method doTable() with Parse#2, the Parse subtree corresponding to that table. TestOccupants#1, the fixture object, runs the tests by accessing the cells in the table via Parse#2. The fixture object marks the cells of passing tests by calling the method right(), inherited from Fixture, on Parse#3, one of the table cells. The right() method, in turn, calls the method addToTag() of Parse#3 to add the coloring. Figure 37.2. FileRunner Runs the Test in the File Once it has run all the tables in a file, FileRunner writes out the updated Parse tree to a report file. This file shows all the markings carried out during the testing. |