#test #framework #harness #libtest #built-in


Write your own test harness that looks and behaves like the built-in test harness used by rustc --test

5 releases (3 breaking)

Uses new Rust 2021

0.4.1 Jun 7, 2022
0.4.0 May 13, 2022
0.3.0 Jun 28, 2020
0.2.0 Oct 2, 2019
0.1.0 Jul 23, 2018

#25 in Testing

Download history 1901/week @ 2022-03-10 2404/week @ 2022-03-17 2431/week @ 2022-03-24 2253/week @ 2022-03-31 2317/week @ 2022-04-07 1591/week @ 2022-04-14 2435/week @ 2022-04-21 2796/week @ 2022-04-28 2880/week @ 2022-05-05 2698/week @ 2022-05-12 2948/week @ 2022-05-19 3851/week @ 2022-05-26 6317/week @ 2022-06-02 5560/week @ 2022-06-09 5471/week @ 2022-06-16 5495/week @ 2022-06-23

24,096 downloads per month
Used in 47 crates (10 directly)


719 lines


CI crates.io version docs

Write your own test harness that looks and behaves like the built-in test harness (used by rustc --test)! (MSRV 1.56)

This is a simple and small testing framework that mimics the original libtest (used by rustc --test). That means: all output looks pretty much like cargo test and most CLI arguments are understood and used. With that plumbing work out of the way, your test runner can concentrate on the actual testing.

See it in action (with the tidy example):



extern crate libtest_mimic;

use libtest_mimic::{Arguments, Test, Outcome, run_tests};

// Parse command line arguments
let args = Arguments::from_args();

// Create a list of tests (in this case: three dummy tests)
let tests = vec![
    Test {
        name: "long_computation".into(),
        kind: "".into(),
        is_ignored: true,
        is_bench: false,
        data: (),

// Run all tests and exit the application appropriatly (in this case, the
// test runner is a dummy runner which does nothing and says that all s
// passed).
run_tests(&args, tests, |test| Outcome::Passed).exit();

For more examples, see examples/.


Licensed under either of

at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


~76K SLoC