JUnit XML compatible output for Ruby's Test::Unit framework
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
README.rdoc
Rakefile
tuxml.gemspec

README.rdoc

tuxml

tuxml is short for “Test::Unit XML” and adds JUnit XML compatible output to Ruby's Test::Unit framework. The output generated by tuxml should work with a lot of tools, but for now, only the Hudson Continuous Integration Server was tested successfully.

Installation

(sudo) gem install tuxml

Usage

tuxml can be used in one of three ways.

Add tuxml gem to your tests

Inside your test file or test helper, add the following lines

require 'rubygems' # if not already required
require 'tuxml'

Then run the test(s) as usual.

Single test class without changing code

To run a single test class you need to explicitly require the tuxml.rb inside the gem, and choose the xml test runner:

ruby -r /path/to/tuxml.rb path/to/test.rb --runner xml

You can find the path to tuxml.rb by running

gem which tuxml -q

Inside shell scripts, you can use the following way to find the tuxml.rb file:

ruby -r `gem which tuxml -q` path/to/test.rb --runner xml

Testsuite without changing code

To run a testsuite using rake, you need to set the environment variable TESTOPTS to add the tuxml.rb file and choose the xml test runner like this:

TESTOPTS="/path/to/tuxml.rb --runner=xml" rake test

Note that when the test rake task invokes several test suites serially, the XML output file will be overwritten. In this case you need to run each test suite individually and set a different output file for each suite.

Setting the output file name

The default output file name is tests.xml in the current working directory. To change the XML output file name, set the TUXML_OUTPUT_FILE environment variable.

Missing stuff

  • The properties element is not supported because it does not seem to make much sense in this context.

  • The system-out and system-err elements are not supported.

Caveats

Due to the way that tuxml attaches itself to the Test::Unit framework, it is not possible to run the tuxml tests with the XML testrunner provided by tuxml.

Acknowledgements

The idea to use an XML testrunner was inspired from work done by Flavio Castelli.

You can find the (almost complete) XML schema here:

http://ant.1045680.n5.nabble.com/schema-for-junit-xml-output-td1375274.html

An example JUnit output that was used when developing tuxml can be found here:

http://junitpdfreport.cvs.sourceforge.net/viewvc/junitpdfreport/src/resources/examples/testresults/TEST-net.cars.engine.PistonTest.xml?revision=1.9&content-type=text%2Fplain

About tuxml

tuxml was written by Thomas Kadauke on a rainy saturday night.