test-report¶
test-report
generate a complete report including test-cases, tables and statistics for a given test-file.
.. test-report:: My Report
:id: REPORT
:file: ../tests/doc_test/utils/pytest_sphinx_data_short.xml
The following options must be set:
id: An unique id. Will be used as prefix for all created objects.
file: File path to the test file.
Optional options are:
tags: comma separated list of tags. Will be set to all created test objects.
links: comma separated list of links. Will be set to all created test objects.
Example¶
Used code:
.. test-report:: My Report
:id: REPORT
:file: ../tests/doc_test/utils/pytest_sphinx_data_short.xml
:tags: my_report, awesome
:links: SPEC_001
.. spec:: Example specification
:id: SPEC_001
Used as simple link target. See Sphinx-Needs for details.
Result:
Test file: /home/docs/checkouts/readthedocs.org/user_builds/sphinx-test-reports/checkouts/latest/docs/../tests/doc_test/utils/pytest_sphinx_data_short.xml
Template used: /home/docs/checkouts/readthedocs.org/user_builds/sphinx-test-reports/envs/latest/lib/python3.7/site-packages/sphinxcontrib/test_reports/directives/test_report_template.txt
Statistics
Test cases:
ID |
Title |
Result |
---|---|---|
test_insert_similar |
passed |
|
test_rstdim_to_latexdim |
passed |
|
test_theme_api |
failure |
|
test_build |
passed |
|
test_build_latex_doc[lualatex-howto] |
failure |
|
test_generate |
passed |
|
test_texinfo |
skipped |
Failed test cases:
ID |
Title |
Result |
---|---|---|
test_theme_api |
failure |
|
test_build_latex_doc[lualatex-howto] |
failure |
Skipped test cases:
ID |
Title |
Result |
---|---|---|
test_texinfo |
skipped |
Imported data
[‘This file contains a subset of executed tests for Sphinx.’] |
System-out:
|
Text:
System-out:
|
Text:
System-out:
|
Text:
Message:
System-out:
|
Template¶
The following rst-code is used to generate the report.
**Test file**: {file}
**Template used**: {template_path}
**Statistics**
| Test suites: :need_count:`'{id}' in tags and type=='{suite_need}'`
| Test cases: :need_count:`'{id}' in tags and type=='{case_need}'`
| Failed test cases: :need_count:`'{id}' in tags and 'failure' == result and type=='{case_need}'`
| Skipped test cases: :need_count:`'{id}' in tags and 'skipped' == result and type=='{case_need}'`
**Test cases**:
.. needtable::
:filter: '{id}' in tags and type == '{case_need}'
:columns: id, title, result
:style_row: tr_[[copy('result')]]
**Failed test cases**:
.. needtable::
:filter: '{id}' in tags and 'failure' == result
:columns: id, title, result
:style_row: tr_[[copy('result')]]
**Skipped test cases**:
.. needtable::
:filter: '{id}' in tags and 'skipped' == result
:columns: id, title, result
:style_row: tr_[[copy('result')]]
**Imported data**
.. {file_type}:: {title}
:id: {id}{links_string}
:tags: {tags}
:file: {file}
:auto_suites:
:auto_cases:
{content}
Template
--------
The following rst-code is used to generate the report.
.. literalinclude:: ../../sphinxcontrib/test_reports/directives/test_report_template.txt
:language: rst
Used as simple link target. See Sphinx-Needs for details. |