Crate test_retry

source ·
Expand description

This crate provides an attribute macro for retrying tests multiple times before failing.

Examples

By default retry will cause the test to be called three times before failing:

use std::sync::atomic::{AtomicUsize, Ordering};

#[test]
#[retry]
fn default() {
  static COUNTER: AtomicUsize = AtomicUsize::new(1);
  assert_eq!(counter.fetch_add(1, Ordering::Relaxed), 3);
}

Attribute Macros

  • An attribute which can be used with #[test] in order to retry a single test multiple times before failing.