Skip to main content

Software quality: what a green CI doesn't tell you

For teams that follow their unit and integration tests in CI: how many tests there are, which fail, which are flaky or skipped, how much code they cover, and whether that's going the right way. It works with any test runner that writes a JUnit XML report.

CI says the tests passed. It doesn't say half of a suite was deleted to get there. Nor that the same test fails one run in ten, or that a package is still at 60% coverage a month before the release that promised 85%. QA-Board follows every suite commit after commit, compares each suite's tests with the reference's, and fails CI when tests disappear, whether a person or a coding agent removed them.

The Metrics Diff of the coding agent's change against main, suite by suite: missions goes from 10 failed tests to 0, from 24 tests to 12, from 0 skipped to 2, and its coverage doesn't change.The Metrics Diff of the coding agent's change against main, suite by suite: missions goes from 10 failed tests to 0, from 24 tests to 12, from 0 skipped to 2, and its coverage doesn't change.
No test fails any more, because half of them are gone: the Metrics Diff shows the missions suite lost 12 tests and skips 2.

What it changes for your team​

  • The trend, not only today's status. Tests, failures, flaky and skipped tests and coverage, per suite and in total, over weeks of commits.
  • Which tests changed, against which reference. The test viewer compares each suite's tests with the reference's: fixed, broken, removed, skipped, with the failure messages at hand.
  • A green CI you can trust. qa gate (experimental) fails a change that deletes or skips tests, not only one that fails them, and posts its table on the pull request. Owners can add rules in the web app that no commit can loosen.
  • Retries on record. A run done again keeps how its earlier attempts ended, their metrics and their logs, and the gate's comment lists the runs that only passed after a retry: a retried CI job doesn't hide a flaky suite.
  • Your runners, as they are. pytest, GoogleTest, CTest, Maven Surefire: anything that writes JUnit XML. Coverage from coverage.py, gcov, llvm-cov or JaCoCo.

See it in action​

The pictures come from a demo SDK's tests, at the moment the team's coding agent, asked to get CI green, deleted the tests that failed.

Nothing failing, and nothing fixed​

The Metrics Diff above says the missions suite has 12 tests instead of 24, and skips 2. The coverage didn't move: the remaining tests still run the same lines, they no longer check the battery reserve. The test viewer says which tests are gone: click a chip to see those tests, a test to see why it failed in the reference, and press n to go from one failure to the next.

The test viewer of the missions suite against main: no test fails, 12 removed and 2 newly skipped, none fixed. The tree shows test_reserve's tests struck through, and the details of a removed test say it failed in the reference.The test viewer of the missions suite against main: no test fails, 12 removed and 2 newly skipped, none fixed. The tree shows test_reserve's tests struck through, and the details of a removed test say it failed in the reference.
No test fails after the agent's change, and none was fixed: 12 tests are gone and 2 skipped.

The volume of tests over time​

On Trends, every suite added up, commit by commit: written tests make steps, fuzz cases a jump. Read the commits' test reports there to see each test: which fail and since which commit, which are flaky, slower, added or removed (see Track tests and benchmarks over time).

Performance over time on main for six weeks: the sum of Tests over the five suites, default mode. It climbs from 131 as frame, A*, range, registry and reserve tests are written, flat at 249, then jumps to 609 when the codec runs 200 fuzz cases per round trip.Performance over time on main for six weeks: the sum of Tests over the five suites, default mode. It climbs from 131 as frame, A*, range, registry and reserve tests are written, flat at 249, then jumps to 609 when the codec runs 200 fuzz cases per round trip.
The number of tests of every suite added up, commit by commit: written tests make steps, fuzz cases a jump.

Lines without tests, and tests that broke​

Text outputs are diffed with the reference's: coverage.py's report of the lines no test runs, or one line per test with its status, where tests that turned from PASS to FAIL show as changes.

The codec suite's list of tests diffed with the commit before: lines that were PASS are now FAIL, for varint round trips and frames with sequence numbers over 2^32; the run's metrics above say 17 failed.The codec suite's list of tests diffed with the commit before: lines that were PASS are now FAIL, for varint round trips and frames with sequence numbers over 2^32; the run's metrics above say 17 failed.
One line per test, diffed with the reference's: the tests the varint fast path broke show as changed lines.

Fail CI on the agent's change​

The gate fails: the missions suite has fewer tests and more skipped tests than its reference run.

qaboard.yaml
# Experimental: may change without notice
# Each run is one suite in one mode. A failed test doesn't fail the run: the run measured it. Runs fail when the
# suite couldn't run at all (max_failed_runs).
gate:
reference: main
labels: [ci]
rules:
- {metric: failed, max: 0, aggregate: max} # no suite has a failing test (flaky ones are reported, not gated)
- {metric: errors, max: 0, aggregate: max} # nor errors in fixtures or collection
- {metric: tests, per_test_max_regression: 0%} # no suite loses tests
- {metric: skipped, per_test_max_regression: 0%} # nor skips more of them
- {metric: coverage, per_test_max_regression: 2%} # nor loses more than 2% of its coverage
max_failed_runs: 0

failed uses aggregate: max, so that one failing test in any suite fails the gate; a median over the suites would hide it. Flaky tests are reported, not gated: gate on them once you have none. See Quality gate for the rules.

With --post-comment github (or gitlab), the gate's table goes to the pull request, where the change is reviewed, and is updated on each push. It also says which runs only passed after being done again, and which rules the commit loosened compared with the reference's qaboard.yaml (see comment on pull requests).

Rules a commit can't loosen​

An agent asked to get CI green can also edit qaboard.yaml. A project's owners can set rules in the web app (experimental, like the gate), under Admin → Quality gate: qa gate checks them on every commit, whatever the commit says, and can fail a commit that loosens its own rules (see set a project's gate rules). The gate runs in your CI, which a commit can change too: project rules make loosening the gate a visible act, not an impossible one.

The Quality gate tab of kitefin/inference-gateway: the reference's qaboard.yaml rules, then the project rules: p99 10% for every run, throughput 5% only for qa batch capacity, no failed run, wait for the ci batch, and "Fail the gate" when a commit loosens its rules.The Quality gate tab of kitefin/inference-gateway: the reference's qaboard.yaml rules, then the project rules: p99 10% for every run, throughput 5% only for qa batch capacity, no failed run, wait for the ci batch, and "Fail the gate" when a commit loosens its rules.
Owners add rules that every commit is held to, whatever its qaboard.yaml says, here one only for the capacity batch.

Track more than test counts​

Return any number your tools compute, and declare which way is better (Declaring metrics):

MetricWhere it comes fromHow to follow it
Failed, errorsJUnit XML reportsA gate rule with max: 0 and aggregate: max.
Flaky testsRerunning the failures alone; Surefire's rerunFailingTestsCount, Bazel's --flaky_test_attemptsCount them per suite, and list them in the report. Gate on them once there are none.
Skipped and disabled testsJUnit XML (<skipped>, GoogleTest's DISABLED_ tests)A rising count hides failures: per_test_max_regression: 0%.
Line and branch coveragecoverage.py, gcov or llvm-cov, JaCoCoPer package, with a target. Also return the lines without tests: their sum is the project's, where percentages don't add up.
Coverage of the changed linesdiff-cover against the reference branchPer commit: "the lines this change added are 40% covered".
Mutation scoremutmut, Stryker, PIT, MullExpensive: in a nightly batch, per package. It says whether tests check the code they run, which coverage doesn't.
Test time, slowest testsJUnit XML timesPer suite, and a plot of the slowest tests with the reference's overlaid.
Warnings and static analysis findingsThe compiler's log, clang-tidy, ruff, cppcheck (SARIF)Counts per category: per_test_max_regression: 0% keeps them from growing.
Sanitizer and Valgrind errorsA configuration of the suites built with ASan, UBSan or TSanCounts per suite, like failed tests.
Build time, binary sizeThe buildA run per target, a configuration per build type.
FuzzinglibFuzzer, AFL, HypothesisA nightly batch with a time budget: crashes found, corpus coverage.

Counts (tests, findings, lines without tests) add up over suites: follow them with the sum. Rates (coverage, pass rate) don't: follow each suite's, or return the counts they come from.

How it's set up​

Map your tests to runs​

A run is a test suite in one configuration, not a test case. A suite is what your CI runs as one command: a test executable, a pytest folder, a CTest label. Its configurations are how you run it: build types, sanitizers, the deprecation warnings that fail the tests in a strict mode. The run's metrics count its test cases, and the test cases themselves are in the run's JUnit XML report, which the test viewer compares with the reference's.

  • Inputs are the suites: folders recognized by a file in them (see Recognize inputs inside folders). Configurations are the modes, set in a batch's matrix.
  • A failing test doesn't fail the run: the run measured it, and returns failed: 3. Return is_failed when the suite couldn't run at all, like a crash before any report was written: the gate counts those separately.
  • Counts add up over suites: pick the sum on the Trends page to follow all of them together.
Why not one run per test case?

You can: an iter_inputs() function can list the tests of gtest_project --gtest_list_tests as inputs. It's the right choice when each test takes minutes and writes outputs worth looking at: a simulation, a hardware-in-the-loop scenario, an end-to-end test with logs and videos. For unit tests, it isn't:

  • Each run is a process. In the example, a run takes about 2 s, most of it starting Python, pytest and coverage.py. Its 609 tests in two modes as 1,218 runs would take 40 minutes of CPU instead of 20 s.
  • A run per test makes the commit page a list of pass/fail cards, and the Metrics Diff a table of 0s and 1s. Per suite, the Metrics Diff says "missions: 12 tests instead of 24", and the test viewer says which.
  • The database copes either way. A run is one row of the outputs table, with a few hundred bytes of metrics: the example's 10 runs per commit make 10,000 rows for 1,000 commits. Garbage collection deletes the runs' files after a while, keeps their metrics, and keeps everything on the reference branch and milestones (see Deleting old data).

The configuration​

Each suite is a folder of tests/, recognized by its suite.yaml: the package whose coverage it measures, a label and tags. The visualizations are the files each run writes.

qaboard.yaml
inputs:
# relative to this folder: each suite is a folder of tests, tests/<suite>/, recognized by its suite.yaml
database:
linux: tests
globs: suite.yaml
use_parent_folder: true
batches: qa/batches.yaml

outputs:
metrics: qa/metrics.yaml
style:
width: 840px
visualizations:
- name: Tests
path: junit.xml # pytest's JUnit XML report: QA-Board's test viewer compares it with the reference's
height: 440
- name: Lines without tests
path: coverage.txt # coverage.py's report: per file, the lines and branches no test runs
- name: Test list
path: tests.txt # one line per test, its status then its id, as text: diffed
max_lines: 30
renderSideBySide: false # inline: the ids are long
default_hidden: true
- name: Slowest tests
path: slowest.plotly.json
side_by_side: false
default_hidden: true
- name: HTML report
path: report.html # the same tests, in a report our code writes: what a run can show without a viewer
default_hidden: true
- name: Benchmarks
path: pytest.benchmarks.json # pytest-benchmark's file, in the codec's and the client's default runs: QA-Board's
height: 440 # benchmark viewer compares each benchmark with the reference's
The metrics: which way is better, and the coverage target

The web app colors changes with them, and the gate knows a regression. Coverage has a target, so the Summary shows the share of runs that reach it. The counts say how they add up, and which are parts of tests, for the charts of Trends (grouping metrics).

qa/metrics.yaml
# yaml-language-server: $schema=https://samsung.github.io/qaboard/metrics.schema.json
# Metrics returned by run() in qa/main.py, for one suite in one mode. Counts add up over the suites (aggregation: sum),
# and passed, failed... are parts of tests (part_of), so that the Trends page charts the whole SDK's tests without
# configuration: filter it on one mode, else each test counts twice. The benchmarks' metrics are declared in code
# (qaboard.benchmarks.benchmark_metrics, in qa/main.py).
default_metric: tests
summary_metrics: [failed, flaky, skipped, tests, coverage, lines_missed]
main_metrics: [tests, failed, flaky, skipped, coverage, lines_missed]
dashboard_evolution_metrics: [tests, failed, flaky, skipped, errors, coverage, branch_coverage, lines_missed, test_time]

available_metrics:
tests:
label: Tests
description: Test cases collected, skipped ones included. More isn't always better, but fewer means some were deleted.
smaller_is_better: false
precision: 4
group: Tests
aggregation: sum
failed:
label: Failed
description: Tests that failed, and failed again when run alone.
smaller_is_better: true
target: 0
target_passfail: true
group: Tests
aggregation: sum
part_of: tests
intent: danger
coverage:
label: Line coverage
short_label: Coverage
description: Lines of the suite's package that its tests run (coverage.py). The SDK 1.6 target is 85% in every package.
suffix: '%'
scale: 100
smaller_is_better: false
target: 0.85
lines_missed:
label: Lines without tests
short_label: Untested lines
description: Lines of the suite's package that no test runs. The packages don't overlap, so their sum is the SDK's.
smaller_is_better: true

To start smaller, without a run() function: qa upload junit.xml in the CI job that runs your tests saves the report as a run, with the counts of tests as metrics (Upload results from any tool). You get the test viewer, Trends and the gate; the example adds coverage, flaky tests found by running failures again, and modes.

The example's qa/junit.py reads the JUnit XML reports of pytest, GoogleTest (--gtest_output=xml:junit.xml), CTest (--output-junit) and Maven Surefire, which reports flaky tests itself, to compute the metrics. It uses the standard library only: copy it, and change the command that qa/main.py runs. The test viewer reads the same reports.

What QA-Board doesn't do (yet)​

  • Each test's history is read when you ask for it. Trends reads the test reports of up to 100 commits of a branch (a prototype): QA-Board stores nothing per test case, so the gate can't check one, and a test's history doesn't go further back than those commits.
  • No ratios of sums. The project's line coverage is 1 - sum(lines without tests) / sum(lines): plot its parts, or add a run that measures coverage over all the tests, in a batch of its own.
  • Targets apply to each run. A target of 85% coverage is each suite's. A goal for the total, like "1,000 tests by the release", is read on the sum's line: QA-Board doesn't draw it.

Try it on the demo​

In examples/software-quality, a fleet SDK (a telemetry codec, path planning, battery estimates, mission assignment, a client) has five test suites, one per package, run with pytest under coverage.py in two modes: default, and strict, where deprecation warnings are errors. Each run reads the JUnit XML report, reruns the failures alone to tell flaky tests from failed ones, and returns the counts and the coverage. The codec's and the client's suites also run their micro-benchmarks with pytest-benchmark, in default mode.

The story the pictures tell: six weeks of commits
  1. The platform team targets 85% line coverage in every package for release 1.6. People and the team's coding agent write tests: the number of tests goes from 131 to 249, the lines without tests from 98 to 20.
  2. An unrolled varint encoder breaks round trips of values over 2^32: 17 codec tests fail, and the codec's coverage goes up, because the buggy fast path runs.
  3. The agent's registry tests share a global registry: one of them fails after another, and passes alone. It shows as flaky until a fixture clears the registry.
  4. A call to a deprecated function fails 9 client tests in strict mode only.
  5. A change to mission assignment ignores the robots' battery reserve, and 10 missions tests fail. Asked to get CI green, the coding agent deletes the reserve tests and skips two others. No test fails, the coverage doesn't move, and the quality gate fails: the missions suite lost 12 tests. The team lead fixes the bug instead.
  6. A lookup table makes the CRC, and so every frame, several times faster to encode and decode: the codec's and the client's micro-benchmarks run with their suites, and Trends names the commit.
  7. 200 fuzz cases per round trip take the codec from 132 tests to 492: the volume jumps, nothing else does.

You need Python 3.11 or later.

pip install qaboard pytest coverage pytest-benchmark
cd examples/software-quality
qa run --input missions # one suite, about 2 s
qa batch ci # 5 suites in 2 modes, about 20 s

qa batch ci shows the results in the web app. With the quickstart's server, first export QABOARD_URL=http://localhost:5151 QA_STORAGE=/tmp/qaboard.

To see the story's bugs, write its flags, e.g. echo '{"bug_missions_reserve": true}' > build/flags.json, and run the suite again: see the example's README.

Where next​

  • Project integrationTest reports
    The files the test viewer reads, and how to write them.
  • Project integrationThe quality gate
    Fail CI on regressions. Experimental.
  • Project integrationCI integration
    Run qa batch in your CI.