Crate testkit_async

Crate testkit_async 

Source
Expand description

§testkit-async 🧰

Practical testing tools for async Rust

testkit-async provides time control, deterministic execution, and failure injection to make async testing fast, reliable, and easy.

§Quick Start

use testkit_async::prelude::*;

#[testkit_async::test]
async fn test_with_timeout() {
    let clock = MockClock::new();
     
    let future = timeout(Duration::from_secs(30), operation());
    clock.advance(Duration::from_secs(31));
     
    assert!(future.await.is_err()); // Instant test!
}

§Features

  • ⏱️ Mock Clock - Control time without waiting
  • 🎮 Deterministic Executor - Control task execution order
  • 💥 Failure Injection - Simulate errors and timeouts
  • 🔍 Async Assertions - Fluent testing API
  • 🎯 Sync Points - Coordinate multiple tasks

Re-exports§

pub use error::Error;
pub use error::Result;

Modules§

assertions
Async assertions and test helpers Fluent assertions for async code
chaos
Failure injection and chaos engineering Simulate failures, timeouts, and errors
clock
Mock clock for time control in tests Virtual time control for async tests
error
Error types Error definitions
executor
Test executor with deterministic execution Controlled async task execution
mock
Mock trait helpers Utilities for mocking async traits
prelude
Prelude for convenient imports Convenient re-exports
sync
Synchronization primitives for tests Sync points and coordination helpers