#testing #mark-flaky-tests #mark-flaky-tests-macro

macro mark-flaky-tests-macro

Mark, debug and auto-retry your flaky tests (proc-macro crate)

3 stable releases

1.0.2 Sep 11, 2023

#2821 in #testing

Download history 47/week @ 2024-12-26 45/week @ 2025-01-02 101/week @ 2025-01-09 140/week @ 2025-01-16 104/week @ 2025-01-23 171/week @ 2025-01-30 182/week @ 2025-02-06 173/week @ 2025-02-13 127/week @ 2025-02-20 80/week @ 2025-02-27 86/week @ 2025-03-06 93/week @ 2025-03-13 65/week @ 2025-03-20 257/week @ 2025-03-27 1167/week @ 2025-04-03 815/week @ 2025-04-10

2,309 downloads per month
Used in 7 crates (via mark-flaky-tests)

MIT/Apache

6KB
105 lines

build status docs.rs license is MIT or Apache 2.0

mark-flaky-tests

There're some tests that sometimes pass and sometimes fail. We call them "flaky".

This crate provides a macro attribute #[flaky] that allows you to mark all the flaky tests in your codebase. You then have two options:

  1. In default mode, #[flaky] will retry a test for a few times and pass it if at least one run has passed.
  2. In strict mode, #[flaky] will still run test for a few times, but will only pass it if every run has passed.

To enable strict mode, set the environment variable MARK_FLAKY_TESTS_STRICT=true.

To adjust the amount of times a test is retried, set the environment variable MARK_FLAKY_TESTS_RETRIES to the desired amount. Default is 3.

To use #[flaky] with #[tokio::test], enable the tokio feature.

Tests that return ExitCode are currently not supported due to std API limitations.

Dependencies

~3MB
~66K SLoC