camel-test
Testing utilities for rust-camel
Testing utilities for rust-camel.
Overview
camel-test provides two main utilities:
CamelTestContext— a test harness that removes boilerplate: registers components, provides simple start/stop methods, and exposes a sharedMockComponentfor assertions.TimeController— deterministic time control for timer-based tests using tokio's built-in mock clock (no realsleepcalls).
Basic usage
use CamelTestContext;
use RouteBuilder;
use Duration;
async
With time control
use CamelTestContext;
use RouteBuilder;
use Duration;
async
Available builder methods
| Method | Effect |
|---|---|
.with_mock() |
Signals mock usage (always registered) |
.with_timer() |
Registers TimerComponent |
.with_log() |
Registers LogComponent |
.with_direct() |
Registers DirectComponent |
.with_seda() |
Registers SedaComponent |
.with_component(c) |
Registers any custom component |
.with_time_control() |
Activates tokio mock clock; build() returns (harness, TimeController) |
Installation
Add to your Cargo.toml:
[]
= "*"