test_imports_join_the_trace

Tests › tests/test_wiki_imports.py

passed Passed in the packaged run.

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

  1. (tmp_path / "src").mkdir()
  2. (tmp_path / "src" / "a.c").write_text("x\n")
9 more
  1. (tmp_path / "a.c.gcov").write_text(_GCOV)
  2. (tmp_path / "r.json").write_text( json.dumps({"tests": [{"nodeid": "t.py::test_ok", "outcome": "passed"}]}) )
  3. (tmp_path / "c.xml").write_text(_CATCH2)
  4. (tmp_path / "j.xml").write_text( '<testsuite><testcase name="A tablet pairs"/><testcase name="A pairing fails">' '<failure message="x"/></testcase></testsuite>' )
  5. (tmp_path / "map.yaml").write_text("R-C: [Store loads]\n")
  6. feat = tmp_path / "tests" / "features" / "pair.feature"
  7. feat.parent.mkdir(parents=True)
  8. feat.write_text(_FEATURE)
  9. 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

  1. rows = { r.req_id: r for r in requirement_evidence( traced, junit=[tmp_path / "j.xml"], inputs=inputs, repo_root=tmp_path ) }
→

Then

  1. ✓ rows["R-A"].tier equals "PASS"
  2. ✓ rows["R-A"].implementers_covered equals ("impl",)
  3. ✓ rows["R-A"].layers equals (("unit", 1),)
  4. ✓ rows["R-B"].tests equals (("tests/features/pair.feature::A tablet pairs", "passed"),)
  5. ✓ rows["R-B"].tier equals "PASS"
  6. ✓ rows["R-B"].layers equals (("bdd", 1),)
  7. ✓ {t for t, _s in rows["R-C"].tests} equals { "Store loads", "tests/features/pair.feature::A pairing fails", }
  8. ✓ rows["R-C"].tier equals "GAP"
  9. ✓ rows["R-C"].layers equals (("bdd", 1), ("cpp", 1))
  10. ✓ rows["R-D"].tier equals "MISSING"
  11. ✓ 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

callercallercallercallerother filesother filesother filesother filesopt (line 200)optloop (line 259)loopelif (line 264)elifopt (line 202)optbuild_wiki132–133. parse_contexts → _contexts_from_lcov132_contexts_from_lcov +1 more134. _text → check_report_size134check_report_size135. _contexts_from_lcov → _relative135_relative136. parse_contexts → _contexts_from_data_file136_contexts_from_data_file

… 172 steps between

callercallercallercallerclew/wiki/build.pyclew/wiki/build.pyclew/wiki/build.pyclew/wiki/build.pyclew/wiki/symbols.pyclew/wiki/symbols.pyclew/wiki/symbols.pyclew/wiki/symbols.pyother filesother filesother filesother filesloop (line 311)looploop (line 332)loopopt (line 335)optloop (line 296)looploop (line 302)loopbuild_wiki309. symbol_pages → symbol_href309symbol_href310. _build_site → parse_features310parse_features311. parse_features → _scenarios311_scenarios▶ test enters312. _scenarios → _tag312_tag313. parse_features → _text313_text314. _build_site → feature_pages314feature_pages315. feature_pages → anchor315anchor

… 29 steps between

callercallercallercallerclew/wiki/build.pyclew/wiki/build.pyclew/wiki/build.pyclew/wiki/build.pyother filesother filesother filesother filesbuild_wiki345. slice_svg → _hidden345_hidden346. _build_site → parse_junit346parse_junit347. parse_junit → fold_cases347fold_cases▶ test enters348. fold_cases → _folded348_folded349–353. parse_junit → _case_name349_case_name +4 more354. _build_site → _lines_by_test354_lines_by_test355. _lines_by_test → lines_per_test355lines_per_test

… 45 later steps

tests/test_wiki_imports.py:241 · its file's page

What it checks (8)

  1. assert rows["R-A"].tier == "PASS" and rows["R-A"].implementers_covered == ("impl",) observes requirement_evidence via rows
  2. assert rows["R-A"].layers == (("unit", 1),) observes requirement_evidence via rows
  3. assert rows["R-B"].tests == (("tests/features/pair.feature::A tablet pairs", "passed"),) observes requirement_evidence via rows
  4. assert rows["R-B"].tier == "PASS" and rows["R-B"].layers == (("bdd", 1),) observes requirement_evidence via rows
  5. assert {t for t, _s in rows["R-C"].tests} == { "Store loads", "tests/features/pair.feature::A pairing fails", } observes requirement_evidence via rows
  6. assert rows["R-C"].tier == "GAP" observes requirement_evidence via rows
  7. assert rows["R-C"].layers == (("bdd", 1), ("cpp", 1)) observes requirement_evidence via rows
  8. assert rows["R-D"].tier == "MISSING" and rows["R-D"].layers == () observes requirement_evidence via rows

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

test_imports_join_the_trace→requirement_evidence

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.

test_imports_join_the_trace · 8 checksrequirement_evidenceconnectREQ-DDB-QUERY-001 · measuredrequirement_evidence_implementer_spanstable_existsREQ-DDB-QUERY-003 · measuredrequirement_evidenceREQ-DDB-WIKI-002 · measuredrequirement_evidence_tierallREQ-DDB-WIKI-054 · inferred
Also reaches 11 requirements

Its run touches their code; that is reach, not proof.