#retry #rerun #again #flaky

fickle

Tools for handling fickle (flaky) tests in rust

4 releases (2 breaking)

0.3.0 Oct 2, 2024
0.2.1 Sep 30, 2024
0.2.0 Sep 30, 2024
0.1.0 Sep 29, 2024

#206 in Testing

Download history 216/week @ 2024-09-24 277/week @ 2024-10-01 8/week @ 2024-10-08 10/week @ 2024-10-15

511 downloads per month
Used in ncpig

GPL-3.0-only

20KB
360 lines

fickle

Handle fickle (flaky) tests in rust.

Usage

The primary api is to use the fickle macro attribute like this:

#[test]
#[fickle]
fn flaky_test() {
    // your test here
}

By default, it will re-run your test 1 time (if the first time fails). If you want to allow more than 1 retry you can specify that with the retries argument.

#[test]
#[fickle(retries=3)]
fn flakier_test() {
    // your test here
}

There is also the option of using the Fickle struct (which is what the macro expands to under the hood). This would look something like this

#[test]
fn flaky_test() {
    let fickle = fickle::Fickle::default();
    let block: fn() -> () = || {
        // your test here
    };
    fickle.run(block).unwrap();
}

Dependencies

~0.7–11MB
~68K SLoC