Skip to main content

unittest-xml-reporting

unittest-xml-reporting is a unittest test runner that can save test results to XML files that can be consumed by a wide range of tools, such as build systems, IDEs and continuous integration servers.

Author:

Daniel Fernandes Martins <daniel@destaquenet.com>

Company:

Destaquenet Technology Solutions

Requirements

Installation

The easiest way to install unittest-xml-reporting is via EasyInstall. Follow these instructions to install EasyInstall if you don’t have it already.

Then, execute the following command line to install the latest stable version of unittest-xml-reporting:

$ sudo easy_install unittest-xml-reporting

If you use Git and want to get the latest development version:

$ git clone git://github.com/danielfm/unittest-xml-reporting.git
$ cd unittest-xml-reporting
$ sudo python setup.py install

Or get the latest development version as a tarball:

$ wget http://github.com/danielfm/unittest-xml-reporting/tarball/master
$ tar zxf danielfm-unittest-xml-reporting-XXXXXXXXXXXXXXXX.tar.gz
$ cd danielfm-unittest-xml-reporting-XXXXXXXXXXXXXXXX
$ sudo python setup.py install

Usage

The script below, adapted from the unittest documentation, shows how to use XMLTestRunner in a very simple way. In fact, the only difference between this script and the original one is the last line:

import random
import unittest
import xmlrunner

class TestSequenceFunctions(unittest.TestCase):
    def setUp(self):
        self.seq = range(10)

    def test_shuffle(self):
        # make sure the shuffled sequence does not lose any elements
        random.shuffle(self.seq)
        self.seq.sort()
        self.assertEqual(self.seq, range(10))

    def test_choice(self):
        element = random.choice(self.seq)
        self.assert_(element in self.seq)

    def test_sample(self):
        self.assertRaises(ValueError, random.sample, self.seq, 20)
        for element in random.sample(self.seq, 5):
            self.assert_(element in self.seq)

if __name__ == '__main__':
    unittest.main(testRunner=xmlrunner.XMLTestRunner(output='test-reports'))

Django 1.2

In order to plug XMLTestRunner to a Django project, add the following to your settings.py:

TEST_RUNNER = 'xmlrunner.extra.djangotestrunner.XMLTestRunner'

Also, the following settings are provided so you can fine tune the reports:

TEST_OUTPUT_VERBOSE (Default: False)

Besides the XML reports generated by the test runner, a bunch of useful information is printed to the sys.stderr stream, just like the TextTestRunner does. Use this setting to choose between a verbose and a non-verbose output.

TEST_OUTPUT_DESCRIPTIONS (Default: False)

If your test methods contains docstrings, you can display such docstrings instead of display the test name (ex: module.TestCase.test_method). In order to use this feature, you have to enable verbose output by setting TEST_OUTPUT_VERBOSE = True.

TEST_OUTPUT_DIR (Default: ".")

Tells the test runner where to put the XML reports. If the directory couldn’t be found, the test runner will try to create it before generate the XML files.

Release files for unittest-xml-reporting 1.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for unittest-xml-reporting 1.3.2
File Size Uploaded
unittest-xml-reporting-1.3.2.tar.gz 11.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for unittest-xml-reporting 1.3.2
File Interpreter ABI Platform
unittest_xml_reporting-1.3.2-py2.6.egg Legacy Egg format - - Details
unittest_xml_reporting-1.3.2-py2.5.egg Legacy Egg format - - Details

Total release size: 55.0 kB

Release files / unittest-xml-reporting-1.3.2.tar.gz

Download URL unittest-xml-reporting-1.3.2.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
dec3a08e2bee908c01e04bac5fbe7bf5fd1572a8a9922c423bcaa787fcd1d4fc
BLAKE2b-256 checksum
How to use checksums
aa3aab28d4e81eb8b17566ce0699f8c3466885943401974b7914e07a95cd27ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / unittest_xml_reporting-1.3.2-py2.6.egg

Download URL unittest_xml_reporting-1.3.2-py2.6.egg
Size 21.6 kB
Tags Egg
SHA-256 checksum
How to use checksums
280401730b3094f5b2852c6001d7ac9e7ac8db00aec93059776717963b6b7ee6
BLAKE2b-256 checksum
How to use checksums
9d6e66b41db2e109d57dec294cfac6aced25d2621e644f2bf69d68b2a5d985ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / unittest_xml_reporting-1.3.2-py2.5.egg

Download URL unittest_xml_reporting-1.3.2-py2.5.egg
Size 21.6 kB
Tags Egg
SHA-256 checksum
How to use checksums
b606ecdb37f641a0dd802b2597b901591d04f1b82f50727ac593578231a5bf4e
BLAKE2b-256 checksum
How to use checksums
7873ea19f24f019ff1063e464e0904e10803941513162b65e59fcc9745cccc27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

4.0.0

2 release files

3.2.0

2 release files

3.1.0

2 release files

3.0.4

2 release files

3.0.3

2 release files

3.0.2

2 release files

2.5.2

2 release files

2.5.1

2 release files

2.5.0

2 release files

2.4.0

2 release files

2.3.2

2 release files

2.3.1

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.14.0

2 release files

1.13.0

2 release files

1.12.0

2 release files

1.11.0

2 release files

1.9.3

2 release files

1.9.2

1 release file

1.9.1

1 release file

1.9.0

1 release file

1.8.1

1 release file

1.8.0

1 release file

1.7.0

1 release file

1.6.0

1 release file

1.5.0

5 release files

1.4.3

4 release files

1.4.2

5 release files

1.4.1

5 release files

1.4

5 release files

This release

1.3.2 This release

3 release files

1.3.1

2 release files

1.3

3 release files

1.2

3 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page