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.
(sudo) gem install tuxml
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.
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.
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.
The idea to use an XML testrunner was inspired from work done by Flavio Castelli.
You can find the (almost complete) XML schema here:
An example JUnit output that was used when developing tuxml can be found here:
tuxml was written by Thomas Kadauke on a rainy saturday night.