test_imports_join_the_trace¶
Tests › tests/test_wiki_imports.py
What this test is for
Why it exists
ONE TRACE FROM EVERY SOURCE: an indexed test with a pytest-json result, a scenario with a JUnit result under its own name, a Catch2 case linked by the mapping file, and gcov coverage. Layers count each requirement's tests by layer; R-D, tested nowhere, has no layers.
Given
(tmp_path / "src").mkdir()(tmp_path / "src" / "a.c").write_text("x\n")
9 more
(tmp_path / "a.c.gcov").write_text(_GCOV)(tmp_path / "r.json").write_text( json.dumps({"tests": [{"nodeid": "t.py::test_ok", "outcome": "passed"}]}) )(tmp_path / "c.xml").write_text(_CATCH2)(tmp_path / "j.xml").write_text( '<testsuite><testcase name="A tablet pairs"/><testcase name="A pairing fails">' '<failure message="x"/></testcase></testsuite>' )(tmp_path / "map.yaml").write_text("R-C: [Store loads]\n")feat = tmp_path / "tests" / "features" / "pair.feature"feat.parent.mkdir(parents=True)feat.write_text(_FEATURE)inputs = EvidenceInputs( results=(("pytest-json", "r.json"), ("catch2", "c.xml")), gcov=("*.gcov",), mapping="map.yaml", features=("tests/features/*.feature",), layers=(("unit", ("tests/unit/*",)), ("bdd", ("tests/features/*",)), ("cpp", ("Store *",))), min_layers=2, )
When
rows = { r.req_id: r for r in requirement_evidence( traced, junit=[tmp_path / "j.xml"], inputs=inputs, repo_root=tmp_path ) }
Then
- ✓ rows["R-A"].tier equals "PASS"
- ✓ rows["R-A"].implementers_covered equals ("impl",)
- ✓ rows["R-A"].layers equals (("unit", 1),)
- ✓ rows["R-B"].tests equals (("tests/features/pair.feature::A tablet pairs", "passed"),)
- ✓ rows["R-B"].tier equals "PASS"
- ✓ rows["R-B"].layers equals (("bdd", 1),)
- ✓ {t for t, _s in rows["R-C"].tests} equals { "Store loads", "tests/features/pair.feature::A pairing fails", }
- ✓ rows["R-C"].tier equals "GAP"
- ✓ rows["R-C"].layers equals (("bdd", 1), ("cpp", 1))
- ✓ rows["R-D"].tier equals "MISSING"
- ✓ rows["R-D"].layers equals ()
What it exercises
The parts of the system's flows this test ran, measured by per-test coverage: lit steps ran in this test, dimmed ones did not, and ▶ marks where the test called in. Each title opens the whole flow with these steps lit.
Build this wiki from the index · 11 of 400 steps
… 131 earlier steps
… 172 steps between
… 29 steps between
… 45 later steps
tests/test_wiki_imports.py:241 · its file's page
What it checks (8)
assert rows["R-A"].tier == "PASS" and rows["R-A"].implementers_covered == ("impl",)observesrequirement_evidenceviarowsassert rows["R-A"].layers == (("unit", 1),)observesrequirement_evidenceviarowsassert rows["R-B"].tests == (("tests/features/pair.feature::A tablet pairs", "passed"),)observesrequirement_evidenceviarowsassert rows["R-B"].tier == "PASS" and rows["R-B"].layers == (("bdd", 1),)observesrequirement_evidenceviarowsassert {t for t, _s in rows["R-C"].tests} == { "Store loads", "tests/features/pair.feature::A pairing fails", }observesrequirement_evidenceviarowsassert rows["R-C"].tier == "GAP"observesrequirement_evidenceviarowsassert rows["R-C"].layers == (("bdd", 1), ("cpp", 1))observesrequirement_evidenceviarowsassert rows["R-D"].tier == "MISSING" and rows["R-D"].layers == ()observesrequirement_evidenceviarows
Where the product reaches it
No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.
Call flow
What it reaches
Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.
Also reaches 11 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-CONFIG-001 measured
- REQ-DDB-QUERY-001 measured
- REQ-DDB-QUERY-003 measured
- REQ-DDB-SCHEMA-006 measured
- REQ-DDB-WIKI-002 measured
- REQ-DDB-WIKI-009 measured
- REQ-DDB-WIKI-010 measured
- REQ-DDB-WIKI-015 measured
- REQ-DDB-WIKI-016 measured
- REQ-DDB-WIKI-017 measured
- REQ-DDB-WIKI-054 inferred