Name

NoseXUnit

Version

0.2.0c1

Author(s)

Olivier Mansion

Homepage

http://nosexunit.sourceforge.net

Price

Free

License

GNU Library or Lesser General Public License (LGPL)

IssueTracking

https://sourceforge.net/tracker/?group_id=192367

Download Source

https://sourceforge.net/project/showfiles.php?group_id=192367

Description

NoseXUnit provide a convenient way to produce JUnit like XML reports with PyUnit.

Background

On the one hand, most of complex applications mix different languages and frameworks. On the other hand, test frameworks don't provide standard outputs. This makes difficult to generate an overall report of the tests for your aplication. However, some Java tests frameworks like JUnit with Surefire outputs convenient test report in a simple XML format. This makes further processing simple and convenient for softwares. For example, Bamboo creates interesting reports thanks these XML reports. Our goal is to provide a way to produce test reports in this simple XML format with PyUnit.

Installation

NoseXUnit is a plugin for python-nose. Nose is a convenient way to play your PyUnit test. So NoseXUnit is not actually a Bamboo plugin, but you can launch it thanks Bash builder. Let's see its configuration.

Python installation

First of all, you must install Python in your integration environment. See Python Web Site. After installation, don't forget to set up the following variables in your environment: PYTHONHOME, PATH, LD_LIBRARY_PATH (or LIBPATH, or SHLIB_PATH).

NoseXUnit installation

Then download ez_setup.py and execute these following commands:

python ez_setup.py -U setuptools
python ez_setup.py -U NoseXUnit

NoseXUnit is now available.

Launch script

Now you need to add a shell in your project's trunk. Let's call it bamboo.sh:

#!/bin/sh
# Set Python environment
PYTHONHOME=$1
export PYTHONHOME
PATH=$PYTHONHOME/bin:$PATH
export PATH
LD_LIBRARY_PATH=$PYTHONHOME/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
# Remove the first argument (path to PYTHONHOME)
shift 1
# Launch NoseXUnit
nosetests --with-nosexunit $*
# Exit status of nose
exit $?

Bamboo configuration

Step in the Builder configuration panel of your project in Bamboo. Choose Bash for Builder. Set Argument to:

./bamboo.sh /path/to/python/home --xml-report-folder=target/xml-report

Where:

  • /path/to/python/home is the path to your Python's home folder
  • --xml-report-folder is the output folder for XML files

Finally check that The build will produce test results is checked, and that Specify custom results directories is set to:

**/target/xml-report/TEST-*.xml

Some other options are available, if you want to enable them just append them to the command line.

NoseXUnit launch options can be display by running:

nosetests --help

Four options are available:

--with-nosexunit           Enable plugin NoseXUnit: Output XML report of test
                           status [NOSE_WITH_NOSEXUNIT]
--xml-report-folder=REPORT
                           Folder to output XML report to
--source-folder=SRC        Set the python's source folder, and add it in the path
--recursive                Walk in the source folder to add deeper folders in the
                           path
  • No labels