Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/uucidl/uu.xunitgen
generates junit/xunit XML files in python
https://github.com/uucidl/uu.xunitgen
jenkins junit python
Last synced: about 1 month ago
JSON representation
generates junit/xunit XML files in python
- Host: GitHub
- URL: https://github.com/uucidl/uu.xunitgen
- Owner: uucidl
- License: mit
- Created: 2013-11-03T13:06:13.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2018-01-03T00:09:30.000Z (almost 7 years ago)
- Last Synced: 2024-04-22T09:20:54.371Z (7 months ago)
- Topics: jenkins, junit, python
- Language: Python
- Homepage:
- Size: 38.1 KB
- Stars: 4
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: ChangeLog
- License: LICENSE
Awesome Lists containing this project
README
Travis-CI: https://travis-ci.org/uucidl/uu.xunitgen.svg?branch=master
Abstract
========``xunitgen`` is a python module for the simple production of ``xunit``
or ``junit`` XML files for use in continuous integration. Such as with
``Jenkins``.It converts a stream of timed (start/finish/error) events and convert
them into a report.It brings / need no dependencies besides an installation of ``Python 2``
or ``Python 3``.Using
=====Once you have added the directory surrounding ``xunitgen`` into your
``PYTHONPATH``, you can create simple test steps by using the
xunitgen.Recorder:.. code:: python
import xunitgen
destination = xunitgen.XunitDestination('.')
with xunitgen.Recorder(destination, 'my-test-suite') as recorder:
with recorder.step('a-success') as step:
passwith recorder.step('a-failing-test') as step:
step.error('this step has failed')with recorder.step('another-failing-test'):
raise Exception('I have failed too!')Which will produce a file named my-test-suite.xml under the current
directoryLower level, event API
----------------------You can also use a lower level API (EventReceiver) if you need finer
control:.. code:: python
import xunitgen
receiver = xunitgen.EventReceiver()
receiver.begin_case('a-test', 0, 'foo')
receiver.failure('because', 'ExceptionFoo')
receiver.end_case('a-test', 9)print xunitgen.tostring(receiver.results())
Example (event_trace module)
----------------------------The xunitgen.event_trace module shows an example of using the lower
level API to convert a tracing format to xUnit files. This can be used
for instance by C programs/tests to produce test traces without having
to implement the xUnit format.*xunitgen/event_traces.py*
Contributing
============If you want to make code contributions to ``xunitgen`` here are the
steps to follow to get a working development environment:Create a virtual environment and activate it
.. code:: example
$ virtualenv venv
$ . venv/bin/activateInstall development dependencies
.. code:: example
$ pip install -r dev_requirements.txt
With the virtual environment active, test your changes before
submitting:.. code:: example
$ nosetests -s tests
Additional Contributors
=======================- Diez Roggisch