Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert trial output to junit xml

How could trial output be converted to JUnit xml format? There is no such possible report format in trial.

$> trial --help-reporters
Trial's output can be customized using plugins called Reporters. You can
select any of the following reporters using --reporter=<foo>

    subunit     subunit output
    bwverbose   Colorless verbose output
    text    terse text output
    verbose     verbose color output (default reporter)
    timing  Timing output
    summary     minimal summary output
like image 364
ДМИТРИЙ МАЛИКОВ Avatar asked Jan 16 '23 15:01

ДМИТРИЙ МАЛИКОВ


2 Answers

I had a hard time with this. Turns out subunit has a new version 2 of it's protocol, and that's what the version of subunit2junitxml was expecting. See https://pypi.python.org/pypi/python-subunit

I had to pipe the results of trial through the subunit-1to2 filter before piping to subunit2junitxml. So the command I ended up with is:

trial --reporter=subunit <mypackage> | subunit-1to2 | subunit2junitxml --no-passthrough --output-to=$WORKSPACE/temp/output.xml

Hope this helps someone.

like image 88
benjas Avatar answered Jan 28 '23 22:01

benjas


The simplest way to do it is by setting the reporter of trial to be subunit and then convert the output to JUnit via the subunit2junitxml found in subunit (under the filters folder in trunk).

For example we do:

trial --reporter=subunit | subunit2junitxml --forward --output-to=junitxml-result.xml
like image 27
mandel Avatar answered Jan 28 '23 22:01

mandel