Friday, June 5, 2009

Day 11 & 12

On Thursday, and part of today, I worked on LightHouse task #126. In FitNesse are these things called scenarios. The scenarios are tables that the user can make which tie the test tables in the acceptance tests to the functions, like fixtures, that will allow FitNesse to test the production code. Whenever an acceptance test is run, FitNesse will grab all the text on the test page and render that text table by table. The test pages will also include Scenario Libraries, and thus when a test page is run, FitNesse also grabs the Scenario Libraries to be rendered. An issue occured recently (when FitNesse was changed from rendering a test page all at once to rendering a test page table by table) where FitNesse would silently crash while running tests if a scenario was ever defined twice. FitNesse would crash because when rendering the page (into html) table by table FitNesse needed a method to find exactly where in the String of text, of the page, a table resided. Knowing where a table resides is important when trying to generate the html after a table has been rendered (the rows of the table have been turned red or green and such). To find that location, FitNesse would search the whole String for the string of characters which make up the table. The issue is that if there are two scenarios (and actually the same problem would occur with two tests that are exactly alike) that are exactly alike, then that search through the String would find only the location of the first scenario, and not the second. Thus, when FitNesse attempted to render the second copy of that table, it would assume the location of the first copy, and an exception would be thrown.
In the end, the solution was fairly simple. All that needed to be done was guarentee that all tables were unique, so I just made a quick little method that added table number attribute to all tables, and generated a random number for each table. In this way, it would be dreadfully unlikely that two tables would even be exactly alike.
Today I was told what my ultimate task for this summer would be. I must find a way to bring FitNesse into Limelight.

No comments:

Post a Comment