Attribute Macro before_all

Source
#[before_all]
Expand description

Will run the code in the matching before_all function exactly once at the very beginning of a test run. It uses std::sync::Once internally to ensure that the code is run at maximum one time. Useful for setting up some external state that will be reused in multiple tests.

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

#[before_all]
#[cfg(test)]
mod my_tests{
    fn before_all(){println!("I get run at the very beginning of the test suite")}
    #[test]
    fn test_1(){}
    #[test]
    fn test_2(){}
    #[test]
    fn test_3(){}
}