← Software Tests for AI Coding Agents
Version 1, 3 November 2026
Software Tests for AI Coding Agents
If you stop reading the code your agents write, the tests become the only thing you read. Twenty-one test types beyond the usual unit test, grouped by what they catch and placed where they run. Tap the plus beside any one for the deep dive.
My current strategy is to not read any of the code written by my agents. That’s the only way I can take advantage of their productivity. What I do instead is to surround the agents with extreme constraints. Unit tests, gherkin tests, QA procedures, quality metrics, mutation testing, test coverage, and a plethora of others.
In the end, I have very high confidence in the code they produce because they’ve had to run the gauntlet of all of my constraints and tests.
The idea has a catch. An agent is a tireless optimiser, and it will satisfy whatever you measure. Some of the tests below find bugs that ordinary tests never reach. The rest exist because a test the agent can read is a test the agent can game.
Where each check runs
One change moves from left to right. The dashed tags are the checks already in Martin’s gauntlet. The numbered tags open the test type below.
-
Before code
The design is checked before anyone writes it.
-
Every commit
Fast, in CI, minutes at most.
-
Nightly
Slow and thorough, hours of compute.
-
Merge gate
Tests the agent has never seen.
-
Staging
A real environment, with faults on purpose.
-
Production
Real users, small exposure first.
Find the bugs your examples miss
An example-based test checks the cases someone thought of. These five make the machine think of the cases.
Property-based testing
State a rule. The machine hunts for an input that breaks it.
- How it works
- You write a property that must hold for every input, not one input and its answer. The tool generates hundreds or thousands of random inputs. When one fails, it shrinks that input to the smallest case that still fails, so the report reads like a hand-written bug.
- What it catches
- Edge cases nobody listed: the empty list, the negative number, the Unicode string, the duplicate key, the value exactly at a boundary.
- Example
from collections import Counter from hypothesis import given, strategies as st @given(st.lists(st.integers())) def test_sort(xs): out = my_sort(xs) assert all(a <= b for a, b in zip(out, out[1:])) # ordered assert Counter(out) == Counter(xs) # nothing lost- Tools
- QuickCheck (Haskell, where the idea started in 2000), Hypothesis (Python), fast-check (JavaScript), jqwik (Java), proptest (Rust).
- Why it fits agent work
- This is the hardest test for an agent to pass by accident. It cannot special-case inputs it has not seen, and it does not know the next random seed. A human writes the properties, which are short and readable. The agent writes the code, which you do not read.
- Limits
- Good properties take thought. A weak property, such as “it does not crash”, passes too easily. Inputs with complex structure need custom generators.
Fuzzing
Throw mutated input at the code until something breaks.
- How it works
- A fuzzer starts from a few sample inputs and mutates them: flips bits, splices files, repeats fields. Coverage-guided fuzzers watch which code paths each input reaches and keep the inputs that reach new paths. Over hours, they walk deep into a parser that no human would test by hand.
- What it catches
- Crashes, hangs, memory corruption, and security holes in anything that reads untrusted input: parsers, file formats, network protocols, deserialisers. Paired with sanitisers, it also finds silent memory errors.
- Example
func FuzzParseDate(f *testing.F) { f.Add("2026-11-03") f.Fuzz(func(t *testing.T, s string) { d, err := ParseDate(s) if err != nil { return } d2, err := ParseDate(d.String()) if err != nil || d2 != d { t.Fatalf("round trip failed for %q", s) } }) } // go test -fuzz=FuzzParseDate- Tools
- AFL++, libFuzzer, Go’s built-in fuzzing, cargo-fuzz (Rust), Atheris (Python), Jazzer (Java). Google’s OSS-Fuzz runs fuzzers on open-source projects and has found tens of thousands of bugs.
- Why it fits agent work
- It needs no oracle and no human judgment, only time and machines. Agents are good at writing fuzz harnesses, and every crash comes back with the exact input to reproduce it. Keep the corpus of past crashes as permanent regression tests.
- Limits
- It finds crashes, not wrong answers, unless you add a check like the round trip above. It needs hours, so it runs nightly, not on every commit.
Metamorphic testing
Test how two outputs relate when nobody knows either answer.
- How it works
- Some programs have no known correct output: a search ranking, a machine-learning model, a route planner, a physics simulation. You cannot assert the answer, but you can assert a relation. Change the input in a known way, and the output must change in a known way.
- What it catches
- Logic errors in code where “correct” is hard to define. The term comes from T. Y. Chen and colleagues in 1998, and it is now common for testing compilers, search engines and models.
- Example
@given(query=queries(), extra=filters()) def test_filter_never_adds_results(query, extra): base = set(search(query)) narrowed = set(search(query.with_filter(extra))) assert narrowed <= base # Other relations: sorting twice equals sorting once. # Rotating a photo must not change the label. # sin(x) == sin(pi - x).- Tools
- No special tool. Write relations inside any property-based framework (number 1).
- Why it fits agent work
- It gives you a test where you could not write one before. Ask the agent to propose relations, then read only the relations, which are one line each.
- Limits
- A relation checks consistency, not truth. Code that is wrong in the same way for both inputs still passes.
Differential testing
Two implementations, the same input, the same answer.
- How it works
- Run two versions of the same behaviour side by side on generated inputs and compare. The pair can be the old code and the rewrite, a fast version and a slow but obviously correct one, or your code and a trusted library.
- What it catches
- Any behaviour change, including the ones nobody thought to write a test for. Csmith used it to find hundreds of bugs in the GCC and LLVM compilers.
- Example
@given(st.binary()) def test_rewrite_matches_legacy(data): assert new_parser(data) == legacy_parser(data)- Tools
- Any property-based framework for the inputs. GitHub’s Scientist library runs the same comparison in production (see number 21).
- Why it fits agent work
- When an agent rewrites or refactors, the old code is a free oracle. Keep it alive as the reference until the comparison has run clean for long enough. You can also ask one agent for a slow, simple reference version and another for the fast one.
- Limits
- Both sides can share a bug. If two agents build from the same misunderstanding, they agree and are both wrong.
Model-based, or stateful, testing
Random sequences of operations, checked against a simple model.
- How it works
- You write a tiny model of the system, often a dictionary or a list. The tool generates long random sequences of operations, such as put, delete, put, get, restart, get. It applies each one to the real system and to the model, and fails on the first disagreement. Then it shrinks the sequence to the shortest one that still fails.
- What it catches
- Bugs that need a specific order of calls: a cache that goes stale after delete then put, a counter that drifts after a restart. Example tests almost never find these.
- Example
class KVStoreMachine(RuleBasedStateMachine): def __init__(self): super().__init__() self.real, self.model = KVStore(), {} @rule(k=st.text(), v=st.integers()) def put(self, k, v): self.real.put(k, v); self.model[k] = v @rule(k=st.text()) def get(self, k): assert self.real.get(k) == self.model.get(k) TestKVStore = KVStoreMachine.TestCase- Tools
- Hypothesis state machines, Erlang QuickCheck from Quviq (used on car software for Volvo), proptest-state-machine (Rust), fast-check model runs.
- Why it fits agent work
- The model is ten lines that a human can check by eye, and it becomes the specification. The agent’s thousand-line implementation must agree with it on every sequence the tool can invent.
- Limits
- The model must stay simpler than the system, or it carries the same bugs. It is hard for systems with large external side effects.
Freeze the behaviour that is right now
Before an agent changes something, record what it does. Then any change in behaviour is a visible event, not a surprise.
Approval, golden-master or snapshot testing
Record the whole output once. A human approves it.
- How it works
- The test saves the complete output, such as a rendered invoice, a JSON response or a report, to a file. A person looks at it once and approves it. From then on, any difference fails the test and shows a diff.
- What it catches
- Any change at all in complex output, where writing an assertion for every field would take days.
- Example
def test_invoice_render(snapshot): assert render_invoice(sample_order()) == snapshot # first run: pytest --snapshot-update (writes the file) # later runs: any difference fails with a diff- Tools
- ApprovalTests (many languages), Jest snapshots, syrupy (Python), insta (Rust), Verify (.NET).
- Why it fits agent work
- You review output, which is what you care about, instead of code. One warning: an agent can re-approve a snapshot with one flag. Approved files must be protected, so that only a human can change them (number 20).
- Limits
- Snapshots break on harmless changes such as timestamps and ordering, so remove that noise first. A big diff gets approved without reading, by people as much as by agents.
Characterization tests
Pin down what old code does, not what it should do.
- How it works
- Michael Feathers named these in Working Effectively with Legacy Code (2004). You call the existing code, observe the result, and write a test that asserts exactly that result, even when it looks wrong. The test documents behaviour as it is today.
- What it catches
- Accidental behaviour changes during a refactor, including changes to quirks that some customer depends on.
- Example
def test_gold_discount_as_it_behaves_today(): # Not a specification. A record of current behaviour. assert legacy_discount(tier="gold", total=100) == 90.0 assert legacy_discount(tier="gold", total=0) == -0.0 # odd, but real- Tools
- Any unit test framework. Approval tools (number 6) make it fast for large outputs.
- Why it fits agent work
- Before you let an agent touch a legacy system, have it write characterization tests first, in a separate commit that a human locks. Then the refactor is safe to run without reading.
- Limits
- It freezes bugs as well as features. Mark the odd ones, so a later fix updates the test on purpose.
Test the seams between the parts
Most production failures happen where two components meet. Mocks hide exactly these failures.
Contract testing
Each consumer writes down what it needs from an API.
- How it works
- The consumer’s tests record the requests it makes and the responses it relies on, as a contract file. The provider’s build replays every contract against the real provider. Neither side needs the other running.
- What it catches
- A provider change that breaks a consumer: a renamed field, a changed type, a removed endpoint. It catches it in the provider’s own build, before deploy.
- Example
{ "consumer": "web-app", "provider": "orders-api", "interactions": [{ "request": { "method": "GET", "path": "/orders/42" }, "response": { "status": 200, "body": { "id": 42, "total": 120.5 } } }] }- Tools
- Pact and its broker, whose
can-i-deploycheck blocks a release that breaks a consumer. Spring Cloud Contract. For schema-first APIs, Schemathesis generates tests from an OpenAPI file. - Why it fits agent work
- When several agents build several services, contracts are how they agree without a shared memory. An agent that changes the API in a way the contract forbids fails its own build.
- Limits
- It checks shape and agreed examples, not business logic. It only knows about the consumers that publish contracts.
Integration tests with real dependencies
A real database in a container, not a mock.
- How it works
- Each test starts a throwaway copy of the real dependency, such as Postgres, Redis or Kafka, in Docker. It runs the real migrations and real queries, then discards the container.
- What it catches
- SQL that a mock accepts and a real database rejects, migration errors, transaction and locking behaviour, driver quirks, time-zone handling.
- Example
from testcontainers.postgres import PostgresContainer def test_migrations_and_first_query(): with PostgresContainer("postgres:16") as pg: engine = create_engine(pg.get_connection_url()) run_migrations(engine) assert count_orders(engine) == 0- Tools
- Testcontainers (Java, Go, Python, .NET, Node and more), Docker Compose in CI, LocalStack for AWS services.
- Why it fits agent work
- Agents write mocks eagerly, and a mock written by the same agent as the code agrees with the code by construction. A real dependency is an outside judge. A useful rule for agents: no mocks for anything you can run in a container.
- Limits
- Slower than unit tests, and it needs Docker in CI. Third-party SaaS APIs still need contracts or sandboxes.
Visual regression testing
Compare screenshots with an approved baseline.
- How it works
- A browser renders each page or component at fixed sizes, takes a screenshot and compares it pixel by pixel with an approved image. A difference above a set level fails the test and shows the changed area.
- What it catches
- Layout breaks, overlapping text, a missing icon, a style change that leaks to another page. Functional tests pass on all of these.
- Example
test('pricing page', async ({ page }) => { await page.goto('/pricing'); await expect(page).toHaveScreenshot('pricing.png', { maxDiffPixelRatio: 0.01 }); });- Tools
- Playwright screenshots, Chromatic for Storybook, Percy, BackstopJS.
- Why it fits agent work
- You look at pictures instead of CSS. Test at phone width too: agents often build for the desktop and break the phone layout without noticing.
- Limits
- Fonts and anti-aliasing differ between machines, so run it in one pinned container. The diff threshold is a judgment call that decides what counts as a defect.
Robustness, speed and safety
The code is correct when everything works. These ask what happens when things do not.
Deterministic simulation testing
Run the whole system inside one repeatable simulation.
- How it works
- All sources of non-determinism, meaning the network, the disk, the clock, threads and random numbers, go through one interface driven by one seed. In tests, a simulator replaces them, injects faults such as dropped packets, crashes and slow disks, and runs millions of steps faster than real time. Any failure replays exactly from its seed.
- What it catches
- The rare bugs of distributed systems: the race that happens once a month, the recovery path that loses data after a crash during a partition. FoundationDB was built this way and is known for how rarely it fails. TigerBeetle runs the same method.
- Example
seed = int(os.environ.get("SEED") or random_seed()) sim = Simulation(seed) # one RNG drives network, disk and clock cluster = sim.start(nodes=5) sim.run(steps=1_000_000, faults=["partition", "crash", "slow_disk"]) assert cluster.invariants_hold(), f"replay with SEED={seed}"- Tools
- Mostly built in-house, as FoundationDB and TigerBeetle did. Antithesis sells it as a service that runs any containerised system in a deterministic hypervisor. In Rust, madsim and turmoil.
- Why it fits agent work
- It is expensive to add later and cheap at the start, and agents can build the abstraction from day one if you require it. A failing seed is also a perfect bug report: the agent replays it until the fix holds.
- Limits
- It needs an architecture that routes all I/O through the simulator. The simulator can differ from reality, so keep some real-world tests as well.
Chaos engineering and fault injection
Break real infrastructure on purpose and watch it recover.
- How it works
- You state what “healthy” means, for example 99% of checkouts succeed. Then you kill a process, add two seconds of network latency, or fill a disk, and check that the system stays inside that definition and recovers.
- What it catches
- Missing timeouts, retry storms, a fallback that was never tested, an alert that never fires. Netflix made the practice famous with Chaos Monkey in 2011.
- Example
# add 2 s of latency between the app and its database toxiproxy-cli toxic add -t latency -a latency=2000 postgres_proxy # then run the checkout journey and assert it degrades, not fails- Tools
- Toxiproxy for local and CI tests, Chaos Mesh and LitmusChaos for Kubernetes, AWS Fault Injection Service, Gremlin.
- Why it fits agent work
- Agents write the happy path well and the failure path thinly. Fault injection checks the error handling that the code review would have checked.
- Limits
- Real experiments need monitoring and a quick way to stop them. Start in staging with a small blast radius.
Concurrency and consistency checks
Prove, or disprove, that parallel code is safe.
- How it works
- Three tools at three depths. A race detector instruments memory access and reports two threads that touch the same data without a lock. A permutation tester runs every possible thread order for a small test. A history checker records what many clients saw and checks that it matches a legal order of events, which is what “linearizable” means.
- What it catches
- Data races, deadlocks, lost updates, and databases that claim stronger guarantees than they give. Kyle Kingsbury’s Jepsen analyses have found such failures in many well-known databases.
- Example
# the cheapest check there is: turn on the race detector go test -race ./... # C and C++: compile with ThreadSanitizer clang -fsanitize=thread -g server.c -o server && ./server- Tools
- Go’s race detector, ThreadSanitizer, loom (Rust permutation testing), Jepsen and its Elle checker, Porcupine (a linearizability checker).
- Why it fits agent work
- Concurrency bugs are the hardest to see in a code review, so not reading the code costs less here than it seems. The detectors see what reviewers miss.
- Limits
- A race detector finds only the races that the test actually runs. Jepsen-style testing is a project, not a flag.
Performance regression tests
Fail the build when the code gets slower.
- How it works
- Benchmarks run in CI and compare against the main branch or a fixed budget. Load tests push a realistic number of users at a staging copy and check response times. Soak tests run for hours to find slow leaks.
- What it catches
- An accidental N+1 query, a quadratic loop, a memory leak, a lost index. Correct code can still be a hundred times slower than yesterday.
- Example
// k6 load test: fail if the slowest 5% exceed 300 ms export const options = { vus: 50, duration: '2m', thresholds: { http_req_duration: ['p(95)<300'], http_req_failed: ['rate<0.01'], }, };- Tools
- k6, Gatling, Locust for load. criterion (Rust), pytest-benchmark, JMH (Java) and hyperfine for benchmarks. CodSpeed for low-noise benchmarks in CI.
- Why it fits agent work
- Agents choose the simple solution, which is often the slow one, and no functional test notices. A budget makes speed a requirement that the agent must meet.
- Limits
- Shared CI machines are noisy. Measure instruction counts or use dedicated runners, or the test will fail at random and people will learn to ignore it.
Security testing
Scan the code, the dependencies and the running app.
- How it works
- Four families. Static analysis (SAST) reads source code for dangerous patterns such as SQL built from strings. Dependency scanning checks every library against known vulnerabilities. Secret scanning finds keys committed by mistake. Dynamic testing (DAST) attacks the running app from the outside like an attacker would.
- What it catches
- Injection, unsafe deserialisation, a vulnerable library version, an API key in the repository, missing security headers.
- Example
semgrep scan --config p/owasp-top-ten --error # SAST osv-scanner scan -r . # dependencies gitleaks detect # secrets # DAST, against a preview deploy: zap-baseline.py -t https://preview.example.com- Tools
- Semgrep and CodeQL for SAST, OSV-Scanner, Dependabot and Snyk for dependencies, gitleaks and TruffleHog for secrets, OWASP ZAP for DAST.
- Why it fits agent work
- Agents add a new risk: a package name that does not exist, invented by the model, which an attacker can then register. Add a check that every new dependency exists, is not brand new, and is on an allowlist.
- Limits
- Static tools produce false alarms, and logic flaws such as broken authorisation rules slip past all of them. They are a floor, not a security review.
Accessibility testing
Check every page against WCAG automatically.
- How it works
- An engine loads each page in a browser and checks it against the Web Content Accessibility Guidelines: contrast, labels on form fields, alt text, heading order, keyboard focus.
- What it catches
- A button with no name, grey text on grey, an image with no description, a form a screen reader cannot use. Deque, which makes axe, measured that automated checks find a little over half of real issues by count.
- Example
import AxeBuilder from '@axe-core/playwright'; test('checkout is accessible', async ({ page }) => { await page.goto('/checkout'); const results = await new AxeBuilder({ page }).analyze(); expect(results.violations).toEqual([]); });- Tools
- axe-core, Pa11y, Lighthouse, and the accessibility tree in Playwright.
- Why it fits agent work
- It is mechanical, cheap and has a clear pass line, so it suits an agent gate well. Agents often build clickable divs instead of buttons, and this catches that.
- Limits
- The other half needs a person with a screen reader and a keyboard: whether the order makes sense, whether the labels mean anything.
Rules about structure, not behaviour
Behaviour can be perfect while the design rots. If you do not read the code, something else must watch its shape.
Architecture fitness functions
Tests that enforce the design, such as who may import whom.
- How it works
- The term comes from Building Evolutionary Architectures (Ford, Parsons and Kua, 2017). A fitness function is any automated check of an architectural property: layer rules, no dependency cycles, maximum module size, maximum complexity, no new calls to a deprecated API.
- What it catches
- Slow structural decay: the domain layer that starts to import the database, the shortcut that creates a cycle, the file that grows to four thousand lines.
- Example
# .importlinter (Python) [importlinter:contract:domain-pure] name = Domain never imports infrastructure type = forbidden source_modules = myapp.domain forbidden_modules = myapp.infra- Tools
- ArchUnit (Java), NetArchTest (.NET), dependency-cruiser (JavaScript), import-linter (Python), and complexity limits in most linters.
- Why it fits agent work
- This is the code review you are not doing, written down. Agents take the shortest path to a green test, and across hundreds of changes the shortest paths erode any design that is not enforced.
- Limits
- Rules check what you thought to write down. Thresholds such as maximum complexity are judgment calls, and a bad one blocks good work.
Formal specification and model checking
Check every state of the design before writing code.
- How it works
- You describe the design, not the code, in a precise language: the states, the allowed steps, and the rules that must always hold. A model checker then explores every reachable state and returns the exact sequence of steps that breaks a rule.
- What it catches
- Design bugs that no test of the code would reach, because they need a rare order of events. Amazon Web Services has used TLA+ since 2011 and reported subtle bugs found this way in DynamoDB and S3.
- Example
\* TLA+: a transfer must never overdraw an account NoOverdraft == \A a \in Accounts : balance[a] >= 0 Spec == Init /\ [][Next]_vars THEOREM Spec => []NoOverdraft \* TLC checks every reachable state- Tools
- TLA+ with the TLC checker (Leslie Lamport), Alloy (Daniel Jackson), the P language, Dafny and Lean for proofs about code, Kani for Rust.
- Why it fits agent work
- This may be the best match for Martin’s strategy. A specification is short enough to read in full, and the checker does the reasoning. You read fifty lines of design instead of five thousand lines of code, and agents are good at drafting the specification.
- Limits
- It proves the design, not the implementation. Something must still connect the two, which is where model-based tests (number 5) help. The state space must stay small enough to search.
Defences that only agent work needs
A human developer rarely edits a failing test to make it pass. An optimiser does, and the model makers have reported that their own models do this. These three close that gap.
Holdout tests
Tests the agent can never see or change.
- How it works
- Machine learning keeps a test set the model never trains on, because a score on training data means nothing. Do the same with your agents. Keep a second suite in a separate repository the agent has no access to. It runs only after the agent says it is done, against the built product, through its public interface.
- What it catches
- Code that fits the visible tests and nothing else: special cases for the test inputs, behaviour that only works on the fixtures, a feature that passes its own tests and fails the real requirement.
- Example
# CI job that runs after the agent's own suite is green - uses: actions/checkout@v4 with: repository: acme/holdout-tests token: ${{ secrets.HOLDOUT_TOKEN }} # not in the agent's sandbox path: holdout - run: pytest holdout/ --base-url "$PREVIEW_URL"- Tools
- No special tool, only access control: a private repository, a CI secret, and an agent sandbox without that secret.
- Why it fits agent work
- It is the single control that makes every other number honest. When a holdout test fails, report only the behaviour that failed to the agent, never the test itself, or the holdout leaks into the training set.
- Limits
- Someone must write and maintain the holdout suite, and a second agent can do it only if it never shares context with the first. Rotate the tests over time, because feedback slowly teaches the first agent about them.
Test-tamper guards
Fail the build when the tests get weaker.
- How it works
- CI watches the tests themselves. It flags a change that edits code and the tests for that code together. It blocks new skip markers, a lower assertion count, re-approved snapshots, a lower coverage or mutation score, and any edit to protected test paths without a human approval.
- What it catches
- The commonest way an agent “fixes” a failing build: it changes the test, not the code. That includes the quiet versions, such as loosening a tolerance from 0.001 to 0.1.
- Example
changed=$(git diff --name-only origin/main...HEAD) if echo "$changed" | grep -q '^src/' && echo "$changed" | grep -q '^tests/'; then echo "Code and its tests changed together: needs a human"; exit 1 fi if git diff origin/main...HEAD -- tests/ | grep -qE '^\+.*(@skip|xfail|\.only\()'; then echo "A test was skipped"; exit 1 fi- Tools
- CODEOWNERS and branch protection on test folders, a small CI script like the one above, and agent hooks: Claude Code can run a hook before each file edit and refuse edits under
tests/. - Why it fits agent work
- Mutation testing, already in Martin’s gauntlet, tells you how strong the tests are. Tamper guards make sure they stay that strong after the agent has been at them.
- Limits
- New features need new tests, so the guard must tell adding a test from weakening one. Expect to tune it in the first weeks.
Production verification: canary, shadow and synthetic
Let real traffic judge the change, a little at a time.
- How it works
- Three methods. A canary sends a small share of real users, say 5%, to the new version, watches error rates and rolls back by itself if they rise. Shadow traffic copies real requests to the new version and throws its answers away after comparing them with the old version. Synthetic monitoring runs scripted user journeys against production every few minutes.
- What it catches
- Whatever no test environment reproduces: real data shapes, real load, real third-party behaviour. GitHub’s Scientist library ran old and new code side by side on live requests to rewrite critical paths safely.
- Example
# Argo Rollouts: 5% first, automatic analysis, then wider strategy: canary: steps: - setWeight: 5 - pause: { duration: 10m } - analysis: { templates: [ { templateName: error-rate } ] } - setWeight: 50- Tools
- Argo Rollouts and Flagger for canaries, feature flags (LaunchDarkly, Unleash), Scientist and its ports for shadow comparison, Checkly and Datadog Synthetics for scripted journeys.
- Why it fits agent work
- It is the last gate and the only one that sees reality. Automatic rollback means a bad agent change costs a few minutes and a few users, not a night.
- Limits
- It needs good metrics and a clear rollback rule. Shadow traffic must never write twice to anything real, such as payments or emails.
Where to start
Three to add first, if you run Martin’s gauntlet already
- Holdout tests (19). Without them, every other score can be gamed by the agent it measures.
- Property-based tests (1). The cheapest big step in bug-finding, and the properties are short enough to read.
- Formal specifications (18) or simulation (11), if the system is distributed. They find the bugs that the code review would have missed anyway.
The common thread: move what you read from the code to the things that judge the code. Properties, models, contracts and specifications are short. Keep them in human hands.
Sources
The quote: Robert C. Martin, as reported at digg.com/ai/xjqbsn4t.
Property-based testing: Claessen and Hughes, QuickCheck (ICFP 2000). Hypothesis documentation, hypothesis.readthedocs.io.
Fuzzing: OSS-Fuzz, and Go fuzzing, go.dev/doc/security/fuzz.
Metamorphic testing: T. Y. Chen, S. C. Cheung and S. M. Yiu, Metamorphic Testing: A New Approach for Generating Next Test Cases (1998).
Differential testing: Yang, Chen, Eide and Regehr, Finding and Understanding Bugs in C Compilers (PLDI 2011), the Csmith paper.
Characterization tests: Michael Feathers, Working Effectively with Legacy Code (2004).
Contract testing: docs.pact.io. Real dependencies: testcontainers.com.
Deterministic simulation: Will Wilson, Testing Distributed Systems with Deterministic Simulation (Strange Loop 2014). TigerBeetle’s VOPR. antithesis.com.
Concurrency: jepsen.io.
Accessibility: Deque, Automated testing study (2021), and axe-core.
Fitness functions: Ford, Parsons and Kua, Building Evolutionary Architectures (O’Reilly, 2017).
Formal methods: Newcombe et al., How Amazon Web Services Uses Formal Methods (Communications of the ACM, 2015). TLA+.
Production verification: GitHub, Scientist, and Argo Rollouts.
Press Notes at the bottom right to mark up any block, or click any line to edit it directly.