Xunit: output test results in xunit format

This plugin provides test results in the standard XUnit XML format.

It was designed for the Hudson continuous build system but will probably work for anything else that understands an XUnit-formatted XML representation of test results.

Add this shell command to your builder

nosetests --with-xunit

And by default a file named nosetests.xml will be written to the working directory.

In a Hudson builder, tick the box named “Publish JUnit test result report” under the Post-build Actions and enter this value for Test report XMLs:

**/nosetests.xml

If you need to change the name or location of the file, you can set the --xunit-file option.

Here is an abbreviated version of what an XML test report might look like:

<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="nosetests" tests="1" errors="1" failures="0" skip="0">
    <testcase classname="path_to_test_suite.TestSomething"
              name="test_it" time="0">
        <error type="exceptions.TypeError" message="oops, wrong type">
        Traceback (most recent call last):
        ...
        TypeError: oops, wrong type
        </error>
    </testcase>
</testsuite>

Options

--with-xunit

Enable plugin Xunit: This plugin provides test results in the standard XUnit XML format. [NOSE_WITH_XUNIT]

--xunit-file=FILE

Path to xml file to store the xunit report in. Default is nosetests.xml in the working directory [NOSE_XUNIT_FILE]

Plugin

class nose.plugins.xunit.Xunit

Bases: nose.plugins.base.Plugin

This plugin provides test results in the standard XUnit XML format.

addError(test, err, capt=None)

Add error output to Xunit report.

addFailure(test, err, capt=None, tb_info=None)

Add failure output to Xunit report.

addSuccess(test, capt=None)

Add success output to Xunit report.

configure(options, config)

Configures the xunit plugin.

options(parser, env)

Sets additional command line options.

report(stream)

Writes an Xunit-formatted XML file

The file includes a report of test errors and failures.

startTest(test)

Initializes a timer before starting a test.

Source

Table Of Contents

Previous topic

Testid: add a test id to each test name output

Next topic

Third-party nose plugins

This Page