Summary
Demonstrate the new sphinx-test-reports feature that maps JUnit XML <properties> to sphinx-needs fields, enabling automatic requirement traceability from test results.
Background
sphinx-test-reports now supports extracting <properties> elements from JUnit XML and mapping them to sphinx-needs fields. This allows test frameworks (pytest, JUnit 5, Maven Surefire, etc.) to embed requirement IDs directly in test output, which then appear as traceable links in the documentation.
What to implement
- Add
<properties> to the coffee-machine JUnit XML (docs/testsuites/coffee_machine_junit.xml):
<testcase classname="interfaces::tests::test_brew_ctrl_status_fault_detection" name="TEST_SAFETY_SHUTDOWN" time="0.001">
<properties>
<property name="verifies" value="SWREQ_SAFE_SHUTDOWN"/>
</properties>
</testcase>
- Configure
conf.py with the new options:
# Make these JUnit properties available as sphinx-needs fields
tr_extra_options = ["verifies"]
# Map the "verifies" property to sphinx-needs links
tr_property_link_types = {
"verifies": "links",
}
- Verify that the rendered test-run needs automatically link back to the requirements they verify, creating a full traceability chain from requirement → test case → test result.
Acceptance Criteria
References
Summary
Demonstrate the new sphinx-test-reports feature that maps JUnit XML
<properties>to sphinx-needs fields, enabling automatic requirement traceability from test results.Background
sphinx-test-reportsnow supports extracting<properties>elements from JUnit XML and mapping them to sphinx-needs fields. This allows test frameworks (pytest, JUnit 5, Maven Surefire, etc.) to embed requirement IDs directly in test output, which then appear as traceable links in the documentation.What to implement
<properties>to the coffee-machine JUnit XML (docs/testsuites/coffee_machine_junit.xml):conf.pywith the new options:Acceptance Criteria
coffee_machine_junit.xmlcontains<properties>withverifiesentries pointing to existing requirement IDsconf.pyhastr_extra_optionsandtr_property_link_typesconfiguredmake htmlbuilds without errorsReferences