Crates.io | acton_test |
lib.rs | acton_test |
version | |
source | src |
created_at | 2024-10-03 23:47:17.654951 |
updated_at | 2024-12-02 03:27:51.850125 |
description | Testing utilities for Acton agents, providing tools to help in the testing and validation of agent behavior. |
homepage | https://github.com/Govcraft/acton-reactive |
repository | https://github.com/Govcraft/acton-reactive/acton-test |
max_upload_size | |
id | 1395813 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
acton_test
is a Rust crate that provides utilities for testing asynchronous code, particularly focused on improving
the experience of writing and running tests for complex asynchronous systems.
Testing asynchronous code in Rust can be challenging, especially when dealing with complex systems that involve multiple asynchronous operations, potential race conditions, and intricate timing issues. Traditional testing approaches often fall short in providing a seamless experience for developers working with such systems.
Common issues include:
acton_test
addresses these issues by providing a simple, yet powerful procedural macro #[acton_test]
that can be
applied to async test functions. This macro:
tracing
crate for consistent logging across your entire test.Add acton_test
to your Cargo.toml
:
[dev-dependencies]
acton_test = "1.0.0-beta.1"
In your unit or integration test files:
use acton_test::prelude::*;
#[acton_test]
async fn my_async_test() {
// Your async test code here
}
tracing
crate for consistent logging in your tests.The #[acton_test]
macro expands your async test function into a synchronous test that:
This approach ensures that your async tests run in a controlled environment, with proper error handling and logging, without requiring you to set this up manually for each test.
acton_test
is designed to work with Rust's standard library, Tokio, and the tracing
crate. It should be compatible
with most async Rust code, regardless of the specific async framework being used.
While acton_test
is a standalone crate that can be used for testing any asynchronous Rust code, it is currently being
actively used and developed as part of the Acton Actor Framework, an open-source project being created by Govcraft.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.