admixture-macros 0.1.0

Proc macros for declaratively defining test contexts and services
Documentation
  • Coverage
  • 100%
    3 out of 3 items documented0 out of 2 items with examples
  • Size
  • Source code size: 46.03 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 422.56 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 5s Average build duration of successful builds.
  • all releases: 5s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • nils-degroot

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:

[dev-dependencies]
admixture = "0.1"

Define a test context with services:

use admixture::context;

context! {
    MyTestContext {
        database: MockDatabaseSetup,
        cache: MockCacheSetup,
    }
}

With Docker containers

Use admixture-docker for real database/cache containers in tests:

[dev-dependencies]
admixture = "0.1"
admixture-docker = { version = "0.1", features = ["sqlx-postgres"] }
use admixture::context;
use admixture_docker::SqlxPostgresServiceSetup;
use testcontainers_modules::postgres::Postgres;

context! {
    PostgresTestContext {
        postgres: SqlxPostgresServiceSetup,
    }
}

With the test harness

Use admixture-harness for automatic context lifecycle management and context reuse across tests:

[dev-dependencies]
admixture = "0.1"
admixture-harness = "0.1"
use admixture::context;
use admixture_harness::prelude::*;

#[admixture_test(context = MyTestContext)]
async fn test_something(ctx: &MyTestContext) -> Result<(), TestError> {
    // Context is automatically started and shared across tests
    Ok(())
}

admixture_harness::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.