[][src]Attribute Macro tokio::test

#[test]
This is supported on feature="rt-threaded" only.

Marks async function to be executed by runtime, suitable to test enviornment

Options:

  • basic_scheduler - All tasks are executed on the current thread. Used by default.
  • threaded_scheduler - Use multi-threaded scheduler.

Usage

Select runtime

#[tokio::test(threaded_scheduler)]
async fn my_test() {
    assert!(true);
}

Using default

#[tokio::test]
async fn my_test() {
    assert!(true);
}