Skip to main content

test

Attribute Macro test 

Source
#[test]
Expand description

Runs an async function as a synchronous test.

The async-rt crate selects the default executor when it re-exports this macro. A built-in executor can be selected explicitly with, for example, #[async_rt::test(executor = "tokio")].

An explicit selection controls the runtime driving this function and the executor used by async_rt::task. Tests using different executors in the same binary run one at a time.

A custom driver can be supplied with driver = expression. It drives the annotated future without changing the executor used by async_rt::task.