Skip to content

Grow coverage with useful tests

Repeating a passing suite detects regressions without reaching new code. Track two metrics separately: which product problems your checks catch, and which untested behaviors your suite now exercises and asserts.

Use this workflow during feature development and test authoring within your target authority and execution budget. In the Reflow dashboard, the Code coverage view leads with Suite coverage growth (durable line union across accepted captures in the same source/measurement scope) alongside remaining uncovered gaps.

StepCLILocal MCP (query_code_coverage)
Inspect remaining gapsreflow coverage gaps --document <id> --limit 10progress, progress_gaps, progress_history
Read source around missed linesreflow coverage lines --document <id> --path <file> --with-sourceprogress_lines (with_source: true)
Measure single-test gainreflow coverage diff --document <combined> --base <baseline> --jsondiff

The local sidecar MCP (reflow mcp) exposes query_code_coverage. Start with cumulative progress queries so paths already reached by accepted captures in the same source and measurement scope are excluded:

{"operation":"progress","collection":"<collection-id>","repository":"<repository-label>","commit":"<full-commit-hash>"}

Choose the series matching the application, source revision, producer, toolchain, and exclusions, then inspect remaining files and line windows:

{"operation":"progress_gaps","collection":"<collection-id>","series":"<series-id>","query":"src/session","limit":10}
{"operation":"progress_lines","collection":"<collection-id>","series":"<series-id>","version":12,"path":"src/session.go","from":40,"to":120,"with_source":true}

Use the version returned by progress rather than the example value 12. missedRanges are exact within the requested window. with_source reads screened local Git source at the recorded clean commit/tree and keeps unavailable source explicit. Durable ranges require no raw profiles. Follow nextCursor for additional files; if progress_changed is returned, another ingest advanced the series and you should restart the gap read. Filter by component rather than scanning unrelated code.

progress_history returns cumulative reached lines and newLinesHit at each accepted capture. Repeated paths add zero; newly reached paths raise the curve. Separate source, toolchain, and coverable-line universes start distinct series rather than blending percentages. Progress survives raw-profile cleanup, and observed execution alone does not prove passing assertions or per-flow attribution (for per-flow Go attribution, run a golden coverage suite).

Missing instrumentation is unmeasured, never zero. The review-reader MCP profile exposes metadata only. If the local tool or relevant profiles are unavailable, report what is missing directly instead of launching extra setup or runs.

  1. Read the existing suite’s purposes, assertions and retained coverage for the intended application revision. Keep Go statements, LLVM lines and other producers separate. Coverage measures instrumented code only.
  2. Use reflow coverage gaps --document <baseline> --limit 10, then reflow coverage lines --document <baseline> --path <path> --with-source to inspect a candidate’s missed ranges. Follow paging when needed. A gap is an investigation lead, not a test specification or a reachability verdict.
  3. Prefer an uncovered behavior with user impact: an error recovery, empty state, permission boundary, state transition or alternate execution mode. Rank candidates by risk, likely new paths, setup cost and execution cost. Do not choose a large file solely because it has the most missed lines.
  4. Before running, name the behavior, entry action, expected result and oracle (why that result is correct). Add an observable checkpoint and assertion. Merely visiting a screen or executing a line is not a useful behavioral check.

For example, another successful sign-in may add nothing. Checking that an expired session offers recovery, then restores the intended destination, can exercise a distinct path and assert its user-visible contract. Whether it adds coverage is a measurement to make, not a claim to assume.

Use the frozen-binary cumulative workflow. Retain a baseline cumulative document assembled from the existing suite’s raw windows. Run the candidate once within the agreed budget, in its own window against the same frozen instrumented binary, with the same exclusions. Assemble a second cumulative document from the baseline windows plus that window. This reuses saved profiles; it does not rerun the whole suite.

Compare the two documents with:

Terminal window
reflow coverage diff --document <baseline-plus-candidate> \
--base <baseline> --json

Only a likeForLike pair assembled this way measures this candidate’s incremental test gain. Read newlyHit and newlyMissed, including remaining pages; equal totals alone do not establish equal coverage. A cumulative addition should not lose previously covered code: investigate newly missed ranges or an incomplete assembly before claiming gain. Never sum percentages, per-run hit counts or the maximum of separate journeys to manufacture a cumulative total.

Reflow does not automatically merge stored documents, and a document does not attribute process coverage to individual flows; for golden flows, a golden coverage suite does. Keep the raw windows and their process counts, binary identity and apply keys as described in the cumulative guide. If those inputs are unavailable, report gain as unmeasured. Across-build differences and A/A-controlled mutation flips are useful review evidence, not this test-gain experiment.

Record the candidate’s purpose, assertion result, newly hit ranges, baseline and combined document IDs, execution duration, and any setup or cleanup cost. Coverage growth and cost per newly tested behavior help choose the next test; there is no coverage-per-minute score inferred from unrelated captures.

  • New paths and a meaningful passing assertion: keep the test, advance the cumulative baseline, then inspect the remaining risk-bearing gaps.
  • No new paths, but a new contract or oracle: it may still be valuable. Keep it with the explicit reason; record zero coverage gain separately.
  • An equivalent scenario with no new assertion or paths: stop repeating it as a growth exercise and choose a different behavior.
  • Failure or uncertain completion: retain the original and investigate; do not weaken the assertion, repeatedly retry, or call it coverage progress.
  • No gain measurement: say what is missing. Do not report zero, or imply the candidate expanded coverage because it passed.

For a recurring QA loop, keep stable regression journeys and their controls within each comparison. Reserve a bounded part of the agreed budget for test growth between rounds: inspect clean-base gaps, add one justified behavior, measure it, then establish fresh controls for the expanded suite. Do not swap journeys or binaries mid-round, select tests using a private mutation answer key, or retroactively compare old and expanded suites as identical workloads.

The dashboard’s Code coverage view leads with Suite coverage growth and remaining gaps: its durable line union stays flat for repeated execution and rises for newly reached code within the selected source and measurement scope, while the capture-history chart tracks individual process totals. New source or coverable-line universes start separate series so a lower percentage after adding code is never hidden. Use the frozen-binary cumulative workflow when you need causal incremental gain rather than accumulated observed reach, and Changed-line coverage when reviewing pull request diffs.