bi-13 — Analysis
Required invariants
- A test must fail for the reason the bug exists. A fix at the wrong layer with a passing test proves nothing.
- Run the test against unpatched source first. A test that passes before your fix is not a test.
- A failing test keeps running. Chromium forbids a bare
[ Skip ]so that flakiness data keeps accruing and an accidental fix is detected. - Expectations carry a bug link. An entry without one is an untracked known-broken behaviour.
- WPT is the cross-browser contract. A Chromium-only test cannot express interop.
The policy worth stealing
"Normally we should not skip a test because it's failing or flaky. We should add failure or flaky expectations instead, so that they will still run on bots, and we can collect data about their flakiness."
Three reasons this beats skipping:
- A skipped test yields no data; an expected-failure that unexpectedly passes is reported.
- Flakiness is measurable only if the test runs.
- Skipped tests rot silently; failing-but-running tests stay honest.
Measured: TestExpectations is 9,418 lines, with platform tags down to specific OS versions
(Mac13, Win11-arm64). Version-specific expectations are an admission that behaviour varies by OS
version — usually through system libraries for fonts, shaping, and media.
Test-layer selection
| Layer | Catches | Misses |
|---|---|---|
| Unit | algorithms, invariants | integration, real DOM |
| Browser test | cross-process, navigation, security | fine-grained algorithm cases |
| Web test | DOM and rendering behaviour | non-web-exposed internals |
| WPT | spec conformance, interop | Chromium-specific internals |
Preference within web tests: testharness.js → reftest → pixel baseline. Same ordering as
behavioural assertions over snapshots in application testing, and for the same reason: a snapshot
asserts "it looks like this," not "it is correct."
Failure modes
| Mistake | Consequence |
|---|---|
| Rebaseline to make it pass | encodes a bug as expected |
| Pixel test for an algorithmic bug | brittle; rebaselined away in six months |
| Unit test for a rendering bug | does not demonstrate the user-visible fix |
| Assume a failing WPT is a Chromium bug | may be a spec disagreement or a stale imported test |