Crates.io | acton_test |
lib.rs | acton_test |
version | 1.0.0-beta.1 |
source | src |
created_at | 2024-10-03 23:47:17.654951 |
updated_at | 2024-10-03 23:47:17.654951 |
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 |
size | 6,389 |
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.