Attribute Macro after_all_async

Source
#[after_all_async]
Expand description

Will run the code in the matching after_all function exactly once when all of the tests have run. This works by counting the number of #[test] attributes and decrementing a counter at the beginning of every test. Once the counter reaches 0, it will run the code in after_all. It uses std::sync::Once internally to ensure that the code is run at maximum one time.

#[cfg(test)]
use test_env_helpers::*;

#[after_all]
#[cfg(test)]
mod my_tests{
    fn after_all(){println!("I only get run once at the very end")}
    #[test]
    fn test_1(){}
    #[test]
    fn test_2(){}
    #[test]
    fn test_3(){}
}