Archive for July, 2009

ci_reporter output for Watir

I’ve been using the ci_reporter gem to grab the results from my Test::Unit verifications and put them in an xml file.  Then I apply an xsl stylesheet to the xml to transform the results into html.  It’s not the prettiest report, but it beats reading xml or parsing through command line output.  My goal is to move my test framework to a rails app for better reporting and data management, but for now, I’m sticking with the ci_reporter output.  Here’s how it works:

First you need to install the ci_reporter gem and require the ci_reporter rake task in your framework class (in my case in my Test::Unit class):

require 'ci/reporter/rake/test_unit_loader'

After running your framework, ci_reporter will create ‘test/reports’ subdirectories and place the xml output of your tests in the reports folder.

Next, you’ll need to transform this xml output to html.  This is accomplished by applying an xsl stylesheet to your xml.  I’ve saved my stylesheet text as a doc file here:

https://tcfodor.files.wordpress.com/2009/04/transform-results.doc

To apply the stylesheet, add the following at line 2 of your xml output:

<?xml-stylesheet type="text/xsl" href="transform-results.xsl"?>

In my case, I just make sure the stylesheet is saved in the local directory.  If you want to save it somewhere else, you’ll need to supply a relative path.

As part of my framework, I’ve automated updating the xml output and renaming  it with a test run.  Then it saves the xml output and xsl transform to a network location to share with the rest of the team.

This assumes that IE is your browser of choice, to view the report in Firefox, add the following line to your xml output at line 3.

<xsl:if test="system-property('xsl:vendor')='Transformiix'"></xsl:if>
Advertisements

July 23, 2009 at 9:09 pm Leave a comment


Categories

Recent Tweets