This guide demonstrates how to integrate test reports into your documentation with full traceability between test specifications, test cases, source code, and test results.
Test Specifications: Define what needs to be tested
Test Cases: Actual test implementations in code
Source Code: The implementation being tested
Traceability: Links between all these elements
Test Reports: Results from test execution
By using Sphinx-Needs for test specifications, sphinx-codelinks for code tracing, and sphinx-test-reports for test results, we create a complete traceable testing ecosystem.
// @Test negative factorial values, T_FACT_001, test, [TS_FACTORIAL, IMPL_2]TEST(FactorialTest,Negative){// Link this test to documentation via GTest propertyRecordProperty("need_id","T_FACT_001");RecordProperty("requirement","REQ_MATH_001");RecordProperty("test_spec","TS_FACTORIAL");// This test is named "Negative", and belongs to the "FactorialTest"// test case.EXPECT_EQ(1,Factorial(-5));EXPECT_EQ(1,Factorial(-1));EXPECT_GT(Factorial(-10),0);
The annotation @Testnegativefactorialvalues,T_FACT_001,test creates a traceable link between the test code and the documentation.
GTest Properties (RecordProperty):
need_id: Links the test execution result to the test case need (T_FACT_001)
requirement: Links to the requirement being tested (REQ_MATH_001)
test_spec: Links to the test specification (TS_FACTORIAL)
These properties are included in the XML test report and enable automatic linking between test results and documentation needs.
Sphinx-Needs: For requirements and test specifications
Sphinx-Codelinks: For linking documentation to source code
Sphinx-Test-Reports: For integrating test execution results
You create a fully traceable testing ecosystem where:
✅ Every test links to its specification
✅ Every test links to the code it verifies
✅ Test results are automatically integrated
✅ Coverage is measured and reported
✅ Traceability is bidirectional and complete