#integration-tests #test-collector

macro test-collector-derive

A derive to be able to mark the tests method, so you can iterate over them

2 releases

0.1.2 Jun 17, 2022
0.1.0 May 28, 2022

#91 in #integration-tests

22 downloads per month
Used in test-collector

MIT/Apache

11KB
120 lines

test-collector-derive will give you '#[collect_test]' which you can use to collect the tests this lib using inventory. Supposed to be used together with test-collector, but you can use it by its own.

    #[collect_test]
    #[test]
    pub fn sync_test_success() {
        println!("Executed sync!");
        assert_eq!(true, true);
    }

    #[collect_test(async)]
    #[actix_web::test]
    pub async fn async_test_success() {
        let client = reqwest::Client::builder()
            .build()
            .expect("error during client build");
        let response = client.get("http://localhost:9090/").send().await;
        assert!(response.is_ok());
    }

lib.rs:

Usage

use test_collector_derive::collect_test;

    #[collect_test]
    #[test]
    pub fn sync_test_success() {
        println!("Executed sync!");
        assert_eq!(true, true);
    }

    #[collect_test(async)]
    #[actix_web::test]
    pub async fn async_test_success() {
        let client = reqwest::Client::builder()
            .build()
            .expect("error during client build");
        let response = client.get("http://localhost:9090/").send().await;
        assert!(response.is_ok());
    }

Dependencies

~2MB
~42K SLoC