Testing Your Agent

a2a-rust lets you test an agent at several levels: grade the executor against the protocol's invariants with no server at all, unit-test it against a real event queue, test it end to end over HTTP, and fuzz the parsers that read peer input. Each page below does one of those.

You want toRead
Check your executor handles cancellation, parking and terminal states as the protocol requires, with no serverGrading an executor
Grade a halt store you wroteKill-switch conformance
Unit-test an executor, or test it end to end over HTTP, on both transports and streamingUnit and integration tests
Check the JSON on the wire, or fuzz the parsersWire format and fuzz tests
Measure what the SDK itself costsBenchmark results
Work on a2a-rust itself: mutation testing and the workspace suiteTesting a2a-rust itself

Why no single test type is enough

A key lesson from a2a-rust is that no single testing technique — not even all of them together minus one — is sufficient. Each layer catches a different class of bug, and the gaps between layers are where production incidents hide:

Test typeWhat it provesWhat it cannot prove
Unit testsIndividual functions return correct valuesThat calling code uses those values correctly
Integration testsComponents work together pairwiseMulti-hop and emergent system behavior
Property testsInvariants hold for all generated inputsThat real-world inputs exercise those invariants
Fuzz testsParser doesn't crash on malformed inputSemantic correctness of valid input handling
E2E dogfoodingThe full stack works under realistic conditionsThat your assertions actually detect regressions
Mutation testsYour assertions detect real code changesProtocol-level emergent behavior

The a2a-rust experience: At v0.3.0 the suite held about 1,630 unit/integration/property/fuzz tests (about 1,850 with all feature flags; it has more than doubled since) and a 94-test E2E dogfood suite whose 13 documented passes found 68 real bugs, and CI was fully green — mutation testing, adopted in that release, still found gaps. Tests that looked comprehensive were silently missing assertions on return values, boundary conditions, and delegation correctness. The suite was green, but mutants survived because no test verified the specific behavior being mutated.

This is why mutation testing is an important quality signal: it is the only technique that measures test effectiveness rather than test existence. Every other technique answers "does the code work?" — mutation testing answers "would the tests catch it if the code broke?" In this repo the full sweep runs weekly (Mondays 03:00 UTC) plus on-demand via the workflow_dispatch trigger on .github/workflows/mutants.yml, rather than as a blocking PR gate, because a full sweep can take 100+ minutes per crate; a separate incremental sweep (cargo-mutants --in-diff) is a blocking PR gate, scoped to just the lines a PR changes (it runs once the PR is labelled mutation-test; the required check fails until then). See CI/CD for the full policy. How to run a sweep, and how to read and fix what it reports, is on Testing a2a-rust itself.

Next steps