allure-test-macros
allure-test-macros contains the procedural macros used by the workspace.
In most cases you should depend on allure-cargotest instead, because it re-exports these
macros together with the runtime integration.
Recommended usage
Add the higher-level crate:
Then use the re-exported macros:
use ;
/// Confirms the login check records a page-opening step and assertion evidence.
What the macros do
#[allure_test]wraps a#[test]function with Allure lifecycle setup and teardown.#[step]records a function call as an Allure step.#[log_asserts]rewrites standard Rust assertion macros in a helper function so they can be logged according to the runtime assertion-logging configuration.- Rust doc comments on
#[allure_test]functions are used as the default markdown description. - Use
#[allure_test(doc = false)]to disable doc-comment descriptions for a test. - Optional macro arguments let you override the displayed test or step name, Allure ID, and doc-comment description behavior.
Notes
#[allure_test]supports synchronous#[test]functions and root async tests that compose with runtime-specific attributes such as#[tokio::test].#[allure_test]supports test functions returning()or explicit types that implementstd::process::Termination, includingResult<(), E>,ExitCode, customTermination, and opaqueimpl Terminationreturn values. Result errors and unsuccessful exit codes are reported before the test harness interprets the result.- For Tokio tests, add Tokio to your test crate and place
#[allure_test]above#[tokio::test]. - Allure context is available in the root async test body and awaited helpers, but independently spawned tasks do not implicitly inherit it.
- Test results are written through
allure-rust-commons, which honorsALLURE_RESULTS_DIRwhen set and otherwise usestarget/allure-results. #[allure_test],#[step], and#[log_asserts]can rewrite bare standard assertion macros. Assertion step emission is enabled by default and can be disabled withALLURE_LOG_ASSERTS=falseor[package.metadata.allure] log_asserts = false.- This crate is intended as an implementation crate for proc macros.