axum-impl-testing
Installation
SKILL.md
Axum Testing
Overview
Axum testing has two complementary approaches. Both drive a Router without
binding a real network socket, so tests are fast and deterministic.
tower::ServiceExt::oneshot: the zero-extra-crate approach. ARouteralready implementstower::Service<Request<Body>>, so it can be called directly. This is what the officialexamples/testingcrate uses.axum-testTestServer: an ergonomic wrapper. It builds requests with chainable helpers (.json(),.add_header()) and exposes fluent assertion methods (assert_status_ok,assert_json,assert_text).
Neither replaces the other. ALWAYS build both kinds of test on top of ONE
shared app() constructor so every test exercises the real app wiring.