SQLUnit Canoo2HTML Tool

This tool was contributed by James Henderson.

This tool converts the XML file generated by running SQLUnit with the Canoo reporter, into an XHTML document that can be displayed on a browser. This tool can be combined with the TestDocsGenerator to produce automated SQLUnit test reports, possibly with a continuous integration tool such as CruiseControl.

To run this tool, you can run this ant target:


  $ ant -Dlog.format=canoo \
  -Doutput.file=output/mytests.xml -Dtestfile=test/mock/coretests.xml \
  sqlunit-flat canoo2html
  
Buildfile: build.xml
 
init:
 
precompile:
 
compile:
    [javac] Compiling 10 source files to /home/sujit/src/sqlunit/build
 
compile-test:
    [javac] Compiling 31 source files to /home/sujit/src/sqlunit/build
 
def:
 
test:
 
init:
 
precompile:
 
compile:
    [javac] Compiling 10 source files to /home/sujit/src/sqlunit/build
 
canoo2html:
     [xslt] Processing /home/sujit/src/sqlunit/output/mytests.xml to /home/sujit/src/sqlunit/output/mytests.xml.html
     [xslt] Loading stylesheet /home/sujit/src/sqlunit/etc/canoo2html_result_transform.xsl
 
BUILD SUCCESSFUL
Total time: 10 seconds
  

The first target will run SQLUnit against the test/mock/coretests.xml file, and generate a Canoo XML test log in the output directory. The target need not necessarily be sqlunit-flat, it could also be sqlunit-nested or test from the distribution, or your own custom target to run the tests.

The second target applies an XSL transformation to the Canoo XML file to produce an XHTML file in the output directory (the same directory as the Canoo XML file). The XHTML file name is the same as the Canoo XML file name suffixed with .html. Thus, in our case described above, the XHTML file is output/mytests.xml.html.

The tests are color coded in the XHTML file, successful runs are shown in green and failures in red.