SubUnit details parser - Test detail attachment extractor.
- Python 3.x
- Corey Goldberg, 2014
subunitdetails takes a binary encoded subunit stream, and extracts test details (content object attachments) and saves them to the filesystem.
Using subunitdetails to extract content object attachments:
Invoke the subunitdetails script, with a subunit file name as an argument. It will extract the embedded content objects (test details) from the subunit result, into the current directory:
$ subunitdetails <file_name>
SubUnit is a streaming protocol for test results. The protocol is a binary encoding that is easily generated and parsed. By design all the components of the protocol conceptually fit into the xUnit TestCase -> TestResult interaction.
About Test Details:
Details are MIME-based content objects that may be attached to a TestCase. This is done using the testtools library (extensions to Python’s standard unittest lib). It allows you to attach any information that you could possibly conceive of to a test, and allows testtools to use or serialize that information.
Using subunit, the encoded stream can be parsed. Test suite results and attached Details (with MIME-types) can then be retrieved.
There are a few ways to install subunitdetails.
$ sudo pip install subunitdetails
$ virtualenv -p python3 .env $ source .env/bin/activate $ pip install subunitdetails
Clone the dev repository and install, using a virtualenv:
$ git clone https://github.com/cgoldberg/subunitdetails.git $ cd subunitdetails $ virtualenv -p python3 .env $ source .env/bin/activate $ python3 setup install