admixture
A Rust framework for managing service lifecycles in integration tests. Admixture lets you declaratively define test contexts composed of services (databases, caches, HTTP servers, etc.) with automatic setup and teardown.
Crates
| Crate | Description |
|---|---|
admixture |
Core traits and macros for defining services and contexts |
admixture-macros |
Proc macros for declaratively defining test contexts |
admixture-docker |
Docker container services via testcontainers |
admixture-docker-macros |
Proc macro for defining Docker container services |
admixture-harness |
Test harness with context reuse and grouped execution |
admixture-harness-macros |
Attribute macro for registering tests with contexts |
Quick Start
Add admixture to your dev-dependencies:
[]
= "0.1"
Define a test context with services:
use context;
context!
With Docker containers
Use admixture-docker for real database/cache containers in tests:
[]
= "0.1"
= { = "0.1", = ["sqlx-postgres"] }
use context;
use SqlxPostgresServiceSetup;
use Postgres;
context!
With the test harness
Use admixture-harness for automatic context lifecycle management and context reuse across tests:
[]
= "0.1"
= "0.1"
use context;
use *;
async
test_runner!;
The harness starts each context type once and reuses it across all tests that share that context, significantly reducing test execution time.
License
Licensed under the MIT License.