Examples¶
JSON data example¶
Data:
[
{
"name": "test suite 1",
"tests": 3,
"errors": 0,
"failures": 1,
"skips": 1,
"passed": 1,
"time": "20230515-15:04:32",
"testcase": [
{
"name": "test case 1",
"classname": "class name 1",
"file": "my/test/file_1",
"line": 123,
"time": "20230515-15:04:32",
"result": "failure",
"type": "test type",
"text": "test text",
"message": "all went wrong :( (message)",
"system-out": "system-out text"
},
{
"name": "test case 2",
"classname": "class name 2",
"file": "my/test/file_2",
"line": 123,
"time": "20230515-15:04:32",
"result": "passed",
"type": "test type",
"text": "test text",
"message": "all went great :) (message)",
"system-out": "system-out text"
},
{
"name": "test case 3",
"classname": "class name 3",
"file": "my/test/file_3",
"line": 123,
"time": "20230515-15:04:32",
"result": "skipped",
"type": "test type",
"text": "test text",
"message": "all went wrong :( (message)",
"system-out": "system-out text"
}
]
}
]
.. test-file:: My JSON Test file
:file: ../tests/doc_test/utils/json_data.json
:id: JSON_001
:auto_suites:
:auto_cases:
Text: Message: System-out: |
Text: Message: System-out: |
Text: Message: System-out: |
Importing¶
pytests¶
pytest junit file¶
<testsuite errors="0" failures="0" name="pytest" skips="10" tests="10" time="0.054">
<testcase classname="setup" file="setup.py" line="-1" name="FLAKE8" time="0.000252246856689">
<skipped message="file(s) previously passed FLAKE8 checks" type="pytest.skip">
/home/daniel/workspace/sphinx/sphinx-test-reports/.tox/py27-sphinx15/local/lib/python2.7/site-packages/pytest_flake8.py:106: <py._xmlgen.raw object at 0x7fd5a8a0e950>
</skipped>
</testcase>
<testcase classname="docs.conf" file="docs/conf.py" line="-1" name="FLAKE8" time="0.000167846679688">
<skipped message="file(s) previously passed FLAKE8 checks" type="pytest.skip">
/home/daniel/workspace/sphinx/sphinx-test-reports/.tox/py27-sphinx15/local/lib/python2.7/site-packages/pytest_flake8.py:106: <py._xmlgen.raw object at 0x7fd5a8a0ea10>
</skipped>
</testcase>
<testcase classname="sphinxcontrib.__init__" file="sphinxcontrib/__init__.py" line="-1" name="FLAKE8" time="0.000164031982422">
<skipped message="file(s) previously passed FLAKE8 checks" type="pytest.skip">
/home/daniel/workspace/sphinx/sphinx-test-reports/.tox/py27-sphinx15/local/lib/python2.7/site-packages/pytest_flake8.py:106: <py._xmlgen.raw object at 0x7fd5a8497450>
</skipped>
</testcase>
<testcase classname="sphinxcontrib.test_reports.__init__" file="sphinxcontrib/test_reports/__init__.py" line="-1" name="FLAKE8" time="0.000192880630493">
<skipped message="file(s) previously passed FLAKE8 checks" type="pytest.skip">
/home/daniel/workspace/sphinx/sphinx-test-reports/.tox/py27-sphinx15/local/lib/python2.7/site-packages/pytest_flake8.py:106: <py._xmlgen.raw object at 0x7fd5a8497c10>
</skipped>
</testcase>
<testcase classname="sphinxcontrib.test_reports.junitparser" file="sphinxcontrib/test_reports/junitparser.py" line="-1" name="FLAKE8" time="0.00017786026001">
<skipped message="file(s) previously passed FLAKE8 checks" type="pytest.skip">
/home/daniel/workspace/sphinx/sphinx-test-reports/.tox/py27-sphinx15/local/lib/python2.7/site-packages/pytest_flake8.py:106: <py._xmlgen.raw object at 0x7fd5a84a2350>
</skipped>
</testcase>
<testcase classname="sphinxcontrib.test_reports.test_reports" file="sphinxcontrib/test_reports/test_reports.py" line="-1" name="FLAKE8" time="0.000218152999878">
<skipped message="file(s) previously passed FLAKE8 checks" type="pytest.skip">
/home/daniel/workspace/sphinx/sphinx-test-reports/.tox/py27-sphinx15/local/lib/python2.7/site-packages/pytest_flake8.py:106: <py._xmlgen.raw object at 0x7fd5a84a2a50>
</skipped>
</testcase>
<testcase classname="sphinxcontrib.test_reports.directives.__init__" file="sphinxcontrib/test_reports/directives/__init__.py" line="-1" name="FLAKE8" time="0.000204801559448">
<skipped message="file(s) previously passed FLAKE8 checks" type="pytest.skip">
/home/daniel/workspace/sphinx/sphinx-test-reports/.tox/py27-sphinx15/local/lib/python2.7/site-packages/pytest_flake8.py:106: <py._xmlgen.raw object at 0x7fd5a84a2cd0>
</skipped>
</testcase>
<testcase classname="sphinxcontrib.test_reports.directives.test_env" file="sphinxcontrib/test_reports/directives/test_env.py" line="-1" name="FLAKE8" time="0.000218868255615">
<skipped message="file(s) previously passed FLAKE8 checks" type="pytest.skip">
/home/daniel/workspace/sphinx/sphinx-test-reports/.tox/py27-sphinx15/local/lib/python2.7/site-packages/pytest_flake8.py:106: <py._xmlgen.raw object at 0x7fd5a84ae250>
</skipped>
</testcase>
<testcase classname="sphinxcontrib.test_reports.directives.test_report" file="sphinxcontrib/test_reports/directives/test_report.py" line="-1" name="FLAKE8" time="0.000199317932129">
<skipped message="file(s) previously passed FLAKE8 checks" type="pytest.skip">
/home/daniel/workspace/sphinx/sphinx-test-reports/.tox/py27-sphinx15/local/lib/python2.7/site-packages/pytest_flake8.py:106: <py._xmlgen.raw object at 0x7fd5a84ae950>
</skipped>
</testcase>
<testcase classname="sphinxcontrib.test_reports.directives.test_results" file="sphinxcontrib/test_reports/directives/test_results.py" line="-1" name="FLAKE8" time="0.00019097328186">
<skipped message="file(s) previously passed FLAKE8 checks" type="pytest.skip">
/home/daniel/workspace/sphinx/sphinx-test-reports/.tox/py27-sphinx15/local/lib/python2.7/site-packages/pytest_flake8.py:106: <py._xmlgen.raw object at 0x7fd5a84bf090>
</skipped>
</testcase>
</testsuite>
Autogenerated documentation¶
.. test-file:: Pytest Test File
:id: PYTEST01
:tags: pytest, example
:file: ../tests/doc_test/utils/pytest_data.xml
:auto_suites:
:auto_cases:
Text: Message: |
Text: Message: |
Text: Message: |
Text: Message: |
Text: Message: |
Text: Message: |
Text: Message: |
Text: Message: |
Text: Message: |
Text: Message: |
nosetests¶
nosetests junit file¶
<testsuite name="nosetests" tests="5" errors="0" failures="0" skip="0">
<testcase classname="test_basic_doc" name="test_doc_build_html" time="0.283"/>
<testcase classname="test_dummy" name="test_dummy" time="0.000"/>
<testcase classname="test_empty_doc" name="test_doc_build_html" time="0.108"/>
<testcase classname="test_junit_parser" name="test_init_parser" time="0.001"/>
<testcase classname="test_junit_parser" name="test_xml_object" time="0.001"/>
</testsuite>
Autogenerated documentation¶
.. test-file:: Nosetests Test File
:id: NOSE01
:tags: nose, example
:file: ../tests/doc_test/utils/nose_data.xml
:auto_suites:
:auto_cases:
Filtering¶
Tables¶
Tags must include pytest¶
.. needtable::
:tags: pytest
:columns: id, title, result, time, tags
ID |
Title |
Result |
Time |
Tags |
|---|---|---|---|---|
Pytest Test File |
pytest; example |
|||
pytest |
pytest; example |
|||
FLAKE8 |
skipped |
0.000204801559448 |
pytest; example |
|
FLAKE8 |
skipped |
0.000192880630493 |
pytest; example |
|
FLAKE8 |
skipped |
0.00017786026001 |
pytest; example |
|
FLAKE8 |
skipped |
0.000218152999878 |
pytest; example |
|
FLAKE8 |
skipped |
0.000164031982422 |
pytest; example |
|
FLAKE8 |
skipped |
0.000199317932129 |
pytest; example |
|
FLAKE8 |
skipped |
0.000167846679688 |
pytest; example |
|
FLAKE8 |
skipped |
0.000218868255615 |
pytest; example |
|
FLAKE8 |
skipped |
0.000252246856689 |
pytest; example |
|
FLAKE8 |
skipped |
0.00019097328186 |
pytest; example |
|
nose test data |
pytest; data; awesome |
Must be defined on this page¶
This checks if the filtered needs (test-files, test-suites, test-cases) got defined inside a section called “Importing”.
.. needtable::
:filter: 'Importing' in sections
:columns: id, title, result, time, tags
ID |
Title |
Result |
Time |
Tags |
|---|---|---|---|---|
Nosetests Test File |
nose; example |
|||
nosetests |
nose; example |
|||
test_xml_object |
passed |
0.001 |
nose; example |
|
test_dummy |
passed |
0.0 |
nose; example |
|
test_doc_build_html |
passed |
0.283 |
nose; example |
|
test_doc_build_html |
passed |
0.108 |
nose; example |
|
test_init_parser |
passed |
0.001 |
nose; example |
|
Pytest Test File |
pytest; example |
|||
pytest |
pytest; example |
|||
FLAKE8 |
skipped |
0.000204801559448 |
pytest; example |
|
FLAKE8 |
skipped |
0.000192880630493 |
pytest; example |
|
FLAKE8 |
skipped |
0.00017786026001 |
pytest; example |
|
FLAKE8 |
skipped |
0.000218152999878 |
pytest; example |
|
FLAKE8 |
skipped |
0.000164031982422 |
pytest; example |
|
FLAKE8 |
skipped |
0.000199317932129 |
pytest; example |
|
FLAKE8 |
skipped |
0.000167846679688 |
pytest; example |
|
FLAKE8 |
skipped |
0.000218868255615 |
pytest; example |
|
FLAKE8 |
skipped |
0.000252246856689 |
pytest; example |
|
FLAKE8 |
skipped |
0.00019097328186 |
pytest; example |
Flows¶
Related to specific id¶
.. needflow::
:filter: id == 'PYTEST01' or 'PYTEST01' in links
All test-files and suites¶
This shows all testfiles and testsuites, which are defined somewhere in the overall documentation.
Please note to search for testfile and testsuite (no “-” ), as this are the names of the need-objects
Sphinx-Test-Reports creates when using the directives test-file or test-suite.
.. needflow::
:types: testfile, testsuite
:filter: 'Examples' in sections
![@startuml
' Nodes definition
node "<size:12>Test-File</size>\n**Pytest Test**\n**File**\n<size:10>PYTEST01</size>" as PYTEST01 [[../examples/index.html#PYTEST01]] #ffffff
folder "<size:12>Test-Suite</size>\n**pytest**\n<size:10>PYTEST01_0EA</size>" as PYTEST01_0EA [[../examples/index.html#PYTEST01_0EA]] #cccccc
rectangle "<size:12>Test-Case</size>\n**FLAKE8**\n<size:10>PYTEST01_0EA_D962E</size>" as PYTEST01_0EA_D962E [[../examples/index.html#PYTEST01_0EA_D962E]] #999999
rectangle "<size:12>Test-Case</size>\n**FLAKE8**\n<size:10>PYTEST01_0EA_BCA04</size>" as PYTEST01_0EA_BCA04 [[../examples/index.html#PYTEST01_0EA_BCA04]] #999999
rectangle "<size:12>Test-Case</size>\n**FLAKE8**\n<size:10>PYTEST01_0EA_5B0AB</size>" as PYTEST01_0EA_5B0AB [[../examples/index.html#PYTEST01_0EA_5B0AB]] #999999
rectangle "<size:12>Test-Case</size>\n**FLAKE8**\n<size:10>PYTEST01_0EA_17650</size>" as PYTEST01_0EA_17650 [[../examples/index.html#PYTEST01_0EA_17650]] #999999
rectangle "<size:12>Test-Case</size>\n**FLAKE8**\n<size:10>PYTEST01_0EA_44574</size>" as PYTEST01_0EA_44574 [[../examples/index.html#PYTEST01_0EA_44574]] #999999
rectangle "<size:12>Test-Case</size>\n**FLAKE8**\n<size:10>PYTEST01_0EA_52AB6</size>" as PYTEST01_0EA_52AB6 [[../examples/index.html#PYTEST01_0EA_52AB6]] #999999
rectangle "<size:12>Test-Case</size>\n**FLAKE8**\n<size:10>PYTEST01_0EA_03B18</size>" as PYTEST01_0EA_03B18 [[../examples/index.html#PYTEST01_0EA_03B18]] #999999
rectangle "<size:12>Test-Case</size>\n**FLAKE8**\n<size:10>PYTEST01_0EA_D9167</size>" as PYTEST01_0EA_D9167 [[../examples/index.html#PYTEST01_0EA_D9167]] #999999
rectangle "<size:12>Test-Case</size>\n**FLAKE8**\n<size:10>PYTEST01_0EA_8E5DB</size>" as PYTEST01_0EA_8E5DB [[../examples/index.html#PYTEST01_0EA_8E5DB]] #999999
rectangle "<size:12>Test-Case</size>\n**FLAKE8**\n<size:10>PYTEST01_0EA_E5144</size>" as PYTEST01_0EA_E5144 [[../examples/index.html#PYTEST01_0EA_E5144]] #999999
' Connection definition
PYTEST01_0EA --> PYTEST01
PYTEST01_0EA_D962E --> PYTEST01
PYTEST01_0EA_D962E --> PYTEST01_0EA
PYTEST01_0EA_BCA04 --> PYTEST01
PYTEST01_0EA_BCA04 --> PYTEST01_0EA
PYTEST01_0EA_5B0AB --> PYTEST01
PYTEST01_0EA_5B0AB --> PYTEST01_0EA
PYTEST01_0EA_17650 --> PYTEST01
PYTEST01_0EA_17650 --> PYTEST01_0EA
PYTEST01_0EA_44574 --> PYTEST01
PYTEST01_0EA_44574 --> PYTEST01_0EA
PYTEST01_0EA_52AB6 --> PYTEST01
PYTEST01_0EA_52AB6 --> PYTEST01_0EA
PYTEST01_0EA_03B18 --> PYTEST01
PYTEST01_0EA_03B18 --> PYTEST01_0EA
PYTEST01_0EA_D9167 --> PYTEST01
PYTEST01_0EA_D9167 --> PYTEST01_0EA
PYTEST01_0EA_8E5DB --> PYTEST01
PYTEST01_0EA_8E5DB --> PYTEST01_0EA
PYTEST01_0EA_E5144 --> PYTEST01
PYTEST01_0EA_E5144 --> PYTEST01_0EA
@enduml](../_images/plantuml-b3b770ac0e01089d0c2ffed0659d380de59803d4.png)
![@startuml
' Nodes definition
node "<size:12>Test-File</size>\n**My JSON Test**\n**file**\n<size:10>JSON_001</size>" as JSON_001 [[../examples/index.html#JSON_001]] #ffffff
node "<size:12>Test-File</size>\n**Pytest Test**\n**File**\n<size:10>PYTEST01</size>" as PYTEST01 [[../examples/index.html#PYTEST01]] #ffffff
node "<size:12>Test-File</size>\n**Nosetests Test**\n**File**\n<size:10>NOSE01</size>" as NOSE01 [[../examples/index.html#NOSE01]] #ffffff
folder "<size:12>Test-Suite</size>\n**test suite 1**\n<size:10>JSON_001_C15</size>" as JSON_001_C15 [[../examples/index.html#JSON_001_C15]] #cccccc
folder "<size:12>Test-Suite</size>\n**pytest**\n<size:10>PYTEST01_0EA</size>" as PYTEST01_0EA [[../examples/index.html#PYTEST01_0EA]] #cccccc
folder "<size:12>Test-Suite</size>\n**nosetests**\n<size:10>NOSE01_ED0</size>" as NOSE01_ED0 [[../examples/index.html#NOSE01_ED0]] #cccccc
' Connection definition
JSON_001_C15 --> JSON_001
PYTEST01_0EA --> PYTEST01
NOSE01_ED0 --> NOSE01
@enduml](../_images/plantuml-05904422ef44b68e3544737d173cf056128eb82f.png)