#testing #flaky #mark #debugging #retry #macro #mark-flaky-tests

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

#8 in #flaky

Download history 92/week @ 2024-10-14 34/week @ 2024-10-21 63/week @ 2024-10-28 62/week @ 2024-11-04 42/week @ 2024-11-11 139/week @ 2024-11-18 120/week @ 2024-11-25 183/week @ 2024-12-02 164/week @ 2024-12-09 164/week @ 2024-12-16 68/week @ 2024-12-23 16/week @ 2024-12-30 72/week @ 2025-01-06 126/week @ 2025-01-13 151/week @ 2025-01-20 96/week @ 2025-01-27

450 downloads per month
Used in 3 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
~67K SLoC