Sphinx-Test-Reports

Tool: Sphinx-Test-Reports TOOL_STR

Sphinx extension to import test results from JUnit XML files as linkable Sphinx-Needs (TOOL_SN) objects into the documentation. Supports automatic generation of test-suite and test-case needs with configurable IDs, custom types, and property-based linking to existing Sphinx-Needs objects.

Documentation:

https://sphinx-test-reports.readthedocs.io

Code:

https://github.com/useblocks/sphinx-test-reports

Analysis

@startuml

' Nodes definition 

file "<size:12>Artifact</size>\n**JUnit XML test**\n**result file**\n<size:10>ART_STR_JUNIT_XML</size>" as ART_STR_JUNIT_XML [[../tools/sphinx-test-reports/artifacts.html#ART_STR_JUNIT_XML]] #LightBlue
rectangle "<size:12>Feature</size>\n**Import JUnit**\n**XML test**\n**results**\n<size:10>FE_STR_JUNIT_IMPORT</size>" as FE_STR_JUNIT_IMPORT [[../tools/sphinx-test-reports/features.html#FE_STR_JUNIT_IMPORT]] #Gold{
'child needs:
rectangle "<size:12>Fault</size>\n**JUnit XML file**\n**cannot be**\n**parsed**\n<size:10>ER_STR_XML_PARSE</size>" as ER_STR_XML_PARSE [[../tools/sphinx-test-reports/features.html#ER_STR_XML_PARSE]] #Pink
rectangle "<size:12>Fault</size>\n**JUnit XML file**\n**contains**\n**unexpected**\n**schema**\n<size:10>ER_STR_XML_SCHEMA</size>" as ER_STR_XML_SCHEMA [[../tools/sphinx-test-reports/features.html#ER_STR_XML_SCHEMA]] #Pink
rectangle "<size:12>Fault</size>\n**Test result**\n**status is**\n**incorrectly**\n**classified**\n<size:10>ER_STR_STATUS_WRONG</size>" as ER_STR_STATUS_WRONG [[../tools/sphinx-test-reports/features.html#ER_STR_STATUS_WRONG]] #Pink
rectangle "<size:12>Fault</size>\n**Test result**\n**status is not**\n**detected**\n<size:10>ER_STR_STATUS_MISSING</size>" as ER_STR_STATUS_MISSING [[../tools/sphinx-test-reports/features.html#ER_STR_STATUS_MISSING]] #Pink
}
rectangle "<size:12>Feature</size>\n**Auto-generate**\n**test suite**\n**needs**\n<size:10>FE_STR_AUTO_SUITES</size>" as FE_STR_AUTO_SUITES [[../tools/sphinx-test-reports/features.html#FE_STR_AUTO_SUITES]] #Gold{
'child needs:
rectangle "<size:12>Fault</size>\n**Test suite need**\n**is not created**\n<size:10>ER_STR_SUITE_MISSING</size>" as ER_STR_SUITE_MISSING [[../tools/sphinx-test-reports/features.html#ER_STR_SUITE_MISSING]] #Pink
rectangle "<size:12>Fault</size>\n**Test suite ID**\n**collision**\n<size:10>ER_STR_SUITE_ID_COLLISION</size>" as ER_STR_SUITE_ID_COLLISION [[../tools/sphinx-test-reports/features.html#ER_STR_SUITE_ID_COLLISION]] #Pink
}
rectangle "<size:12>Feature</size>\n**Auto-generate**\n**test case needs**\n<size:10>FE_STR_AUTO_CASES</size>" as FE_STR_AUTO_CASES [[../tools/sphinx-test-reports/features.html#FE_STR_AUTO_CASES]] #Gold{
'child needs:
rectangle "<size:12>Fault</size>\n**Test case need**\n**is not created**\n<size:10>ER_STR_CASE_MISSING</size>" as ER_STR_CASE_MISSING [[../tools/sphinx-test-reports/features.html#ER_STR_CASE_MISSING]] #Pink
rectangle "<size:12>Fault</size>\n**Test case ID**\n**collision**\n<size:10>ER_STR_CASE_ID_COLLISION</size>" as ER_STR_CASE_ID_COLLISION [[../tools/sphinx-test-reports/features.html#ER_STR_CASE_ID_COLLISION]] #Pink
rectangle "<size:12>Fault</size>\n**Test case need**\n**contains wrong**\n**data**\n<size:10>ER_STR_CASE_WRONG_DATA</size>" as ER_STR_CASE_WRONG_DATA [[../tools/sphinx-test-reports/features.html#ER_STR_CASE_WRONG_DATA]] #Pink
}
rectangle "<size:12>Feature</size>\n**Map JUnit**\n**properties to**\n**Sphinx-Needs**\n**links**\n<size:10>FE_STR_PROPERTY_LINKS</size>" as FE_STR_PROPERTY_LINKS [[../tools/sphinx-test-reports/features.html#FE_STR_PROPERTY_LINKS]] #Gold{
'child needs:
rectangle "<size:12>Fault</size>\n**Property link**\n**is not created**\n<size:10>ER_STR_PROP_LINK_MISSING</size>" as ER_STR_PROP_LINK_MISSING [[../tools/sphinx-test-reports/features.html#ER_STR_PROP_LINK_MISSING]] #Pink
rectangle "<size:12>Fault</size>\n**Property link**\n**points to wrong**\n**target**\n<size:10>ER_STR_PROP_LINK_WRONG</size>" as ER_STR_PROP_LINK_WRONG [[../tools/sphinx-test-reports/features.html#ER_STR_PROP_LINK_WRONG]] #Pink
rectangle "<size:12>Fault</size>\n**Undeclared**\n**property link**\n**type causes**\n**silent failure**\n<size:10>ER_STR_PROP_TYPE_UNDECLARED</size>" as ER_STR_PROP_TYPE_UNDECLARED [[../tools/sphinx-test-reports/features.html#ER_STR_PROP_TYPE_UNDECLARED]] #Pink
}
rectangle "<size:12>Feature</size>\n**Configurable**\n**need types for**\n**imported**\n**results**\n<size:10>FE_STR_CUSTOM_TYPES</size>" as FE_STR_CUSTOM_TYPES [[../tools/sphinx-test-reports/features.html#FE_STR_CUSTOM_TYPES]] #Gold{
'child needs:
rectangle "<size:12>Fault</size>\n**Custom type is**\n**not applied to**\n**imported needs**\n<size:10>ER_STR_CUSTOM_TYPE_IGNORED</size>" as ER_STR_CUSTOM_TYPE_IGNORED [[../tools/sphinx-test-reports/features.html#ER_STR_CUSTOM_TYPE_IGNORED]] #Pink
rectangle "<size:12>Fault</size>\n**Custom type ID**\n**prefix**\n**collision with**\n**existing needs**\n<size:10>ER_STR_CUSTOM_TYPE_PREFIX_COLLISION</size>" as ER_STR_CUSTOM_TYPE_PREFIX_COLLISION [[../tools/sphinx-test-reports/features.html#ER_STR_CUSTOM_TYPE_PREFIX_COLLISION]] #Pink
}
rectangle "<size:12>Feature</size>\n**Import test**\n**environment**\n**information**\n<size:10>FE_STR_ENV_IMPORT</size>" as FE_STR_ENV_IMPORT [[../tools/sphinx-test-reports/features.html#FE_STR_ENV_IMPORT]] #Gold{
'child needs:
rectangle "<size:12>Fault</size>\n**Environment**\n**need is not**\n**created**\n<size:10>ER_STR_ENV_MISSING</size>" as ER_STR_ENV_MISSING [[../tools/sphinx-test-reports/features.html#ER_STR_ENV_MISSING]] #Pink
}
rectangle "<size:12>Feature</size>\n**Filter and**\n**display test**\n**results**\n<size:10>FE_STR_DISPLAY</size>" as FE_STR_DISPLAY [[../tools/sphinx-test-reports/features.html#FE_STR_DISPLAY]] #Gold{
'child needs:
rectangle "<size:12>Fault</size>\n**Test results**\n**table is empty**\n**despite**\n**imported data**\n<size:10>ER_STR_DISPLAY_EMPTY</size>" as ER_STR_DISPLAY_EMPTY [[../tools/sphinx-test-reports/features.html#ER_STR_DISPLAY_EMPTY]] #Pink
}
node "<size:12>Tool</size>\n**Sphinx-Test-**\n**Reports**\n<size:10>TOOL_STR</size>" as TOOL_STR [[../tools/sphinx-test-reports/index.html#TOOL_STR]] #0fbcf9
rectangle "<size:12>Restriction</size>\n**Declare all**\n**property link**\n**types in ``tr_p**\n**roperty_link_ty**\n**pes``**\n<size:10>RE_STR_PROP_LINK_TYPES</size>" as RE_STR_PROP_LINK_TYPES [[../tools/sphinx-test-reports/restrictions.html#RE_STR_PROP_LINK_TYPES]] #Orange
rectangle "<size:12>Restriction</size>\n**Set ``tr_case_i**\n**d_length`` and **\n**``tr_suite_id_l**\n**ength`` to**\n**avoid**\n**collisions**\n<size:10>RE_STR_ID_LENGTH</size>" as RE_STR_ID_LENGTH [[../tools/sphinx-test-reports/restrictions.html#RE_STR_ID_LENGTH]] #Orange
rectangle "<size:12>Restriction</size>\n**Use a dedicated**\n**custom type for**\n**imported test**\n**results**\n<size:10>RE_STR_CUSTOM_TYPE</size>" as RE_STR_CUSTOM_TYPE [[../tools/sphinx-test-reports/restrictions.html#RE_STR_CUSTOM_TYPE]] #Orange

' Connection definition 

FE_STR_JUNIT_IMPORT -[#333333]-> TOOL_STR
FE_STR_AUTO_SUITES -[#333333]-> TOOL_STR
FE_STR_AUTO_CASES -[#333333]-> TOOL_STR
FE_STR_PROPERTY_LINKS -[#333333]-> TOOL_STR
FE_STR_CUSTOM_TYPES -[#333333]-> TOOL_STR
FE_STR_ENV_IMPORT -[#333333]-> TOOL_STR
FE_STR_DISPLAY -[#333333]-> TOOL_STR
RE_STR_PROP_LINK_TYPES -[#333333]-> TOOL_STR
RE_STR_PROP_LINK_TYPES -[#FA8072]-> ER_STR_PROP_LINK_MISSING
RE_STR_PROP_LINK_TYPES -[#FA8072]-> ER_STR_PROP_TYPE_UNDECLARED
RE_STR_ID_LENGTH -[#333333]-> TOOL_STR
RE_STR_ID_LENGTH -[#FA8072]-> ER_STR_CASE_ID_COLLISION
RE_STR_ID_LENGTH -[#FA8072]-> ER_STR_SUITE_ID_COLLISION
RE_STR_CUSTOM_TYPE -[#333333]-> TOOL_STR
RE_STR_CUSTOM_TYPE -[#FA8072]-> ER_STR_CUSTOM_TYPE_PREFIX_COLLISION

@enduml

ID

Title

Type

ART_STR_JUNIT_XML

JUnit XML test result file

artifact

ER_STR_CASE_ID_COLLISION

Test case ID collision

fault

ER_STR_CASE_MISSING

Test case need is not created

fault

ER_STR_CASE_WRONG_DATA

Test case need contains wrong data

fault

ER_STR_CUSTOM_TYPE_IGNORED

Custom type is not applied to imported needs

fault

ER_STR_CUSTOM_TYPE_PREFIX_COLLISION

Custom type ID prefix collision with existing needs

fault

ER_STR_DISPLAY_EMPTY

Test results table is empty despite imported data

fault

ER_STR_ENV_MISSING

Environment need is not created

fault

ER_STR_PROP_LINK_MISSING

Property link is not created

fault

ER_STR_PROP_LINK_WRONG

Property link points to wrong target

fault

ER_STR_PROP_TYPE_UNDECLARED

Undeclared property link type causes silent failure

fault

ER_STR_STATUS_MISSING

Test result status is not detected

fault

ER_STR_STATUS_WRONG

Test result status is incorrectly classified

fault

ER_STR_SUITE_ID_COLLISION

Test suite ID collision

fault

ER_STR_SUITE_MISSING

Test suite need is not created

fault

ER_STR_XML_PARSE

JUnit XML file cannot be parsed

fault

ER_STR_XML_SCHEMA

JUnit XML file contains unexpected schema

fault

FE_STR_AUTO_CASES

Auto-generate test case needs

feature

FE_STR_AUTO_SUITES

Auto-generate test suite needs

feature

FE_STR_CUSTOM_TYPES

Configurable need types for imported results

feature

FE_STR_DISPLAY

Filter and display test results

feature

FE_STR_ENV_IMPORT

Import test environment information

feature

FE_STR_JUNIT_IMPORT

Import JUnit XML test results

feature

FE_STR_PROPERTY_LINKS

Map JUnit properties to Sphinx-Needs links

feature

RE_STR_CUSTOM_TYPE

Use a dedicated custom type for imported test results

restriction

RE_STR_ID_LENGTH

Set ``tr_case_id_length`` and ``tr_suite_id_length`` to avoid collisions

restriction

RE_STR_PROP_LINK_TYPES

Declare all property link types in ``tr_property_link_types``

restriction

TOOL_STR

Sphinx-Test-Reports

tool

../../_images/need_pie_a29fb.svg