Since I needed to parse the results of some CUnit tests in Hudson in a recent project, I came up with the following transformation which I apply to the cunit xml result file.
Hudson can then evaluate the results as if they were generated by JUnit. The same approach is basically used in the CppUnit Plugin for Hudson – which is where I got the idea.
Since I’m too lazy at the moment to write my own plugin for Hudson, I figured running xsltproc after running my tests will be good enough:
|
1 |
xsltproc-win32\xsltproc.exe --stringparam suitename testall -o testall_results.xml cunit-to-junit.xsl cunit_testall-Results.xml |
To make CUnit produce XML results, you have to do something like this:
|
1 2 3 |
CU_set_output_filename( "cunit_testall" );
CU_list_tests_to_file();
CU_automated_run_tests(); |
You can download the cunit-to-junit.xsl here.