Test generator UTest
This crates implements a 3-phase utest-harness for Rust. The 3 phases are:
- Setup: the setup function must initialize the context; in case the function panics/aborts, the utest is aborted
fn() -> Context
- Test: if the setup did return with valud context item, this context is used to invoke the test.
fn( & Context )
- Teardown: no matter if the test-function above did panic/abort, the teardown function is invoked to release the context
fn( Context )
No matter of any panic or failing assertion in the second phase (feature testing), the teardown function is invoked. The test will either succeed, or otherwise unwinding a failure in the setup-phase, the test-phase or the teardown-phase.
This crate has been inspired by the post of Eric Opines.
Usage
Please see the test file 'mytests.rs at the executable example.
extern crate test_generator_utest;
// demonstrating usage of utest-harness
Executing the example code cargo test -p test-generator-example testsuite
the testsuote above will print the following output.
running 2 tests
test testsuite::hello_europe ... ok
test testsuite::hello_world ... ok
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 3 filtered out