ADTEST
This crate allows you to easily create tests with setup and cleanup functions, like beforeEach
and afterEach
functions in jest,
it offers this functionality for both async and non-async test.
To use simply add to your crate in lib.rs
or main.rs
extern crate adtest;
After that add #[adtest]
to desired function
If used solely it behaves as #[test]
on non async function and on async functions as #[tokio::test]
.
But unlike those, #[adtest]
allows you to add setup and clean up functions to run before/after your tests.
Example of test with setup
If your setup/cleanup function is async you must specify it with async
keyword before test name:
async