Tuesday, July 7, 2009

Day 29

Yesterday I was given a new task, Lighthouse #117, which is to add a feature that will allow the user to compare a page's test histories. It is supposed to take two page histories, find any differences, and then display those differences to the user. Since the page histories are stored as Xml, my first plan was going to be to scan through the code using regular expressions, and try to compare certain expressions which store whether a page passed or failed. The issue with this was that it would be very difficult to line those expressions up to one another in order to compare one page to another. Also, if a page was different at the times in which the histories were saved, then the comparison would be extremely difficult. Then I found out that there is a nice html parser that would break down the page into more manigable chunks, which I could then compare one section at a time. Even though I found out there was a better way of solving this task, the research I did on regexes will still be useful at some point. They are very very powerful, letting you find in one search that which would have taken 5, 6 , 7 or just a ton of searches in a text editor or a regular text search. And the syntax is pretty easy once you know the 11 metacharacters. But ok, so once I found the html parser, I was able to break a page down into tables, then rows and collumns, and then just the cells which I could then compare to see how similar two pages are. To display the differences of the pages, I started making a result page that would just store all the differences and display them one by one, but now I think I am going to line them up and display the two pages side by side and have some scheme to highlight differences.

No comments:

Post a Comment