#testing #test-runner #test-collector #integration-tests #custom-runner


A library for setting up integration test with start up and tearndown

2 releases

Uses new Rust 2021

0.1.2 Jun 17, 2022
0.1.0 May 28, 2022

#339 in Testing


387 lines

test-collector introduce custom test runner. You can implement your own start and stop functions, which will be invoked only before and after all tests respectively. Also you can override before_each_test and after_each_test to bring additional cleaning or set_up functionality to each of your tests. You will need test-collector-derive, which gives you '#[collect_test]' which you can use to collect the tests this lib using inventory

    pub fn sync_test_success() {
        println!("Executed sync!");
        assert_eq!(true, true);

    pub async fn async_test_success() {
        let client = reqwest::Client::builder()
            .expect("error during client build");
        let response = client.get("http://localhost:9090/").send().await;

You will need to create your own main function and in Cargo.toml of you project add this with needed name and path:

name = "integration"
path = "integration-tests/main.rs"
harness = false

example of the main can be found in test-collector-lib/src/lib.rs:166


~97K SLoC