[][src]Crate kevlar

Kevlar is a light-weight Test Harness that provides basic test features such as logging, setting up a test workspace, and managing the test result object, so that you can focus on writing your tests and the abstractions / support libraries that go along with them.

This crate is designed for writing test suites for testing other software.

If you just want to write unit tests, it is recommended to use Rust's built-in testing features instead.

use kevlar::{ConfigType, TestConfig, TestHarness, TestStatus, TestResult, AsyncTestCase};
use std::path::PathBuf;
use async_trait::async_trait; // Required until async is supported in traits
use log::*;

#[tokio::main]
async fn main() {
    let harness = TestHarness::new(
        "kevlar_example",
        ConfigType::File(PathBuf::from("./config.json")),
    );
    harness.run_async::<MyTest>().await;
}

#[derive(Default)]
struct MyTest;

#[async_trait]
impl AsyncTestCase for MyTest {
    async fn run_async(&mut self, test_config: TestConfig, test_result: &mut TestResult) -> TestStatus {
        info!("Do something interesting!");
        TestStatus::Passed
    }
}

Re-exports

pub use testcase::AsyncTestCase;
pub use testcase::TestCase;
pub use testconfig::ConfigType;
pub use testconfig::TestConfig;
pub use testharness::TestHarness;
pub use testresult::TestResult;
pub use testresult::TestStatus;

Modules

testcase
testconfig
testharness
testresult