#test #tests #unit #testing

ntest

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

22 releases (4 breaking)

✓ Uses Rust 2018 edition

0.5.1 Jan 15, 2020
0.5.0 Jan 15, 2020
0.4.1 Dec 29, 2019
0.3.3 Sep 20, 2019
0.1.10 Aug 30, 2019

#43 in Testing

Download history 98/week @ 2019-11-08 301/week @ 2019-11-15 189/week @ 2019-11-22 387/week @ 2019-11-29 334/week @ 2019-12-06 793/week @ 2019-12-13 182/week @ 2019-12-20 336/week @ 2019-12-27 347/week @ 2020-01-03 932/week @ 2020-01-10 683/week @ 2020-01-17 727/week @ 2020-01-24 265/week @ 2020-01-31 429/week @ 2020-02-07 206/week @ 2020-02-14

1,469 downloads per month
Used in 3 crates

MIT license

16KB
250 lines

NTest

Build Status

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", name="important_test")]
fn test_http_link_types(link: &str) {
    test_link(link, &LinkType::HTTP);
}

Content

  • #[timeout()] Attribute used for timeouts in tests.
  • #[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.

Changelog

Checkout the changelog file to see the changes between different versions.

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

~470–770KB
~18K SLoC