Skip to main content

Crate eventcore_testing

Crate eventcore_testing 

Source
Expand description

Testing utilities for EventCore backends and commands.

This crate provides helpers for verifying that EventStore implementations satisfy their behavioral contracts, injecting failures for chaos and retry testing, and writing readable Given-When-Then command tests.

§Modules

  • contract — Behavioral contract tests via the backend_contract_tests! macro. Run these against any EventStore implementation to verify it upholds all required guarantees (optimistic concurrency, atomicity, ordering, etc.).

  • chaosChaosEventStore: wraps an EventStore and injects probabilistic failures. Use for chaos testing to verify that command retry logic handles transient errors correctly.

  • deterministicDeterministicConflictStore: injects predictable stream-version conflicts on the first write attempt, then succeeds on retry. Use for deterministic testing of the automatic retry path in eventcore::execute().

  • event_collectorEventCollector: a Projector implementation that accumulates every event it sees into a Vec. Use in assertions to confirm which events were written to the store.

  • scenarioTestScenario: a Given-When-Then builder for command tests. Seed the store with prior events (Given), execute a command (When), and assert on the resulting events or error (Then).

Re-exports§

pub use chaos::*;
pub use contract::*;
pub use deterministic::*;
pub use event_collector::*;
pub use scenario::*;

Modules§

chaos
Chaos testing for EventCore backends.
contract
deterministic
Deterministic testing utilities for event stores.
event_collector
Test utility for collecting events during projection for assertions.
scenario
Given-When-Then testing helpers for eventcore commands.

Macros§

backend_contract_tests
Unified contract test macro for all backend implementations.