6 releases (3 breaking)

new 0.4.1 Jan 12, 2025
0.4.0 Jan 12, 2025
0.3.1 Aug 14, 2023
0.3.0 Dec 11, 2022
0.1.1 Jul 19, 2020

#114 in Testing

Download history 192/week @ 2024-09-24 30/week @ 2024-10-01 163/week @ 2024-10-08 308/week @ 2024-10-15 169/week @ 2024-10-22 149/week @ 2024-10-29 136/week @ 2024-11-05 132/week @ 2024-11-12 179/week @ 2024-11-19 119/week @ 2024-11-26 177/week @ 2024-12-03 397/week @ 2024-12-10 465/week @ 2024-12-17 92/week @ 2024-12-24 342/week @ 2024-12-31 456/week @ 2025-01-07

1,433 downloads per month
Used in 2 crates

Apache-2.0

19KB
444 lines

Crates.io Apache-2.0 licensed

Awaitility for Rust

Fast, Simple, Straightforward Test utility for async functionalities.

Getting Started

[dev-dependencies]
awaitility = "0.4"

Awaitility has dev-dependencies of tokio used for its own async fn testing.

Basic Usage

awaitility::at_most(Duration::from_millis(100)).until(|| {test something is true});
awaitility::at_least(Duration::from_millis(100)).always(|| {test something is true});
awaitility::at_most(Duration::from_millis(100)).until_no_panic(|| {assert_eq!(1, 1)});

#[tokio::test]
async fn test() {
  awaitility::at_most(Duration::from_millis(100)).until_async(|| async {test something is true}).await;
}
// ...

See RustDoc for more examples.

Licence

Apache License 2.0

Author

Cause Chung (cuzfrog@gmail.com, cuzfrog@139.com)

No runtime deps