Sphinx-Test-Reports¶
Test results, inside your documentation.
Turn JUnit XML and JSON test results into Sphinx-Needs items you can link, filter and report on, right beside your requirements.
Sphinx-Test-Reports provides the following features:
test-file: Documents all test cases from a junit-based xml file.
test-suite: Documents a specific test-suite and its test-cases.
test-case: Documents a single test-case from a given file and suite.
test-report: Creates a report from a test file, including tables and more for analysis.
test-results: Creates a simple table of test cases inside a given file.
test-env: Documents the used test-environment. Based on tox-envreport.
Introduction¶
A single documented test-case looks like this:
Custom Message: The result is passed with an execution time of 0.009029150009155273. Now follows automatically generated output like system-out, messages and text of the test-case. System-out: # testroot: root
# builder: html
# srcdir: /tmp/add_source_parser
# outdir: /tmp/add_source_parser/_build/html
# status:
#x1B[01mRunning Sphinx v1.7+/aecb0082#x1B[39;49;00m
#x1B[01mloading pickled environment... #x1B[39;49;00mnot yet created
# warning:
|
Take a look into our pytest example to see the complete result of all Sphinx tests (1154 test cases!).
The objects created by Sphinx-Test-Reports are based on
Sphinx-Needs.
So all features for filtering, sorting and showing data is supported.
As example, here is a shorten list of tests results from the Sphinx-pytest example:
ID |
Title |
Result |
|---|---|---|
test_insert_similar |
passed |
|
test_rstdim_to_latexdim |
passed |
|
test_theme_api |
failed |
|
test_build |
passed |
|
test_build_latex_doc[lualatex-howto] |
failed |
|
test_generate |
passed |
|
test_texinfo |
skipped |
Content¶
Test reports come in two distributions: sphinx-test-reports, the Sphinx extension, and ub-test-reports, the converter, the pytest plugin and the parsers, which run without Sphinx and which the extension depends on. The version this site shows is the extension’s; ub-test-reports has its own version and its own changelog.
The Sphinx extension
- Installation
- Directives
- Configuration
- tr_rootdir
- tr_file
- tr_suite
- tr_case
- The need types and their fields
- tr_report_template
- tr_suite_id_length
- tr_case_id_length
- tr_file_option
- tr_source_file_option
- tr_source_line_option
- tr_line_base
- tr_deterministic_case_ids
- tr_extra_options
- tr_property_link_types
- tr_import_encoding
- tr_json_mapping
- Declarative configuration (ubproject.toml)
- Warnings
- Filtering Test Data
- Dynamic functions
- Examples
Without Sphinx (ub-test-reports)
Other Sphinx extensions¶
In the last years, we have created several Sphinx extensions based on or related to Sphinx-Needs, to support the work of teams in (for example) the automotive industry:
Motivation¶
Sphinx-Test-Reports was created for an automotive project, which needs to document test results and their used
environment configuration in an human-readable format.
The goal is to provide enough information to be able to setup an identical test environment in 20+ years.
Sphinx-Test-Reports is part of a software bundle, which was designed to fulfill
the parameters of the ISO 26262 standard
for safety critical software in automotive companies.
Other tools are: sphinx-needs, sphinx-collections and tox-envreport.