#test #tests #unit #testing

ntest

Testing framework for rust which enhances the built-in library with some useful features

16 releases

✓ Uses Rust 2018 edition

new 0.3.0 Sep 17, 2019
0.2.1 Sep 9, 2019
0.1.13 Sep 3, 2019
0.1.10 Aug 30, 2019

#85 in Testing

Download history 54/week @ 2019-08-06 14/week @ 2019-08-13 52/week @ 2019-08-20 97/week @ 2019-08-27 133/week @ 2019-09-03 57/week @ 2019-09-10

136 downloads per month

Custom license

14KB
246 lines

NTest

Testing framework for rust which enhances the built-in library with some useful features. Inspired by the .Net unit-testing framework NUnit.

Getting Started

Some functions of NTest use procedural macros which are stable for rust edition 2018. If you use the library make sure that you are using the 2018 version of rust. Update the Cargo.toml file:

[package]
edition = "2018"
# ..

Add the NTest library to your developer dependencies in the Cargo.toml file:

[dev-dependencies]
ntest = "*"

Use the NTest functions you need. For example:

use test_case_derive::test_case;

#[test_case("https://doc.rust-lang.org.html")]
#[test_case("http://www.website.php")]
fn test_http_link_types(link: &str) {
    test_link(link, &LinkType::HTTP);
}

Content

  • #[test_case()] Attribute used to define multiple test cases for a test function.
  • assert_about_equal!() Compare two floating point values or vectors for equality.
  • assert_false!() Expects false argument for test case.
  • assert_true!() Expects true argument for test case.
  • assert_panics!() Expects block to panic. Otherwise the test fails.

For more information read the documentation.

Contribution

All contributions and comments welcome! Open an issue or create a Pull Request whenever you find a bug or have an idea to improve this crate.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Dependencies

~1–1.2MB
~26K SLoC