简体   繁体   中英

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

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM