#temp-test #cli-test


A library for temporary test utils for rust 🔨

2 releases

0.1.1 May 5, 2020
0.1.0 May 5, 2020

#476 in Testing


184 lines

temp_test - temporary test utils for rust 🔨

Build Status

A simple temporary file library for Rust. This library can create a temporary environment to test your rust cli library, run test against several commands and args even provide different environments. It uses tempfile to securely handle all temporary files.


Minimum required Rust version: 1.32.0

Add this to your Cargo.toml:

temp_test = "0.1.0"


use clap::{Arg, App};

fn main() {
    let matches = App::new("My Super Program")
            .about("Sets the level of verbosity"))
            .about("controls testing features")
                .about("print debug information verbosely")))

    // do some action with the matches..

fn test_example() {
    let p = temp_test::build_project("test_example").build();

    assert!(p.has_file("Cargo.toml"), "Cargo.toml file does not exist");

    let result = p.command("test").run();

    assert!(result.is_success(), "Result was unsuccessful {:?}", result);


Licensed under either of


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.