rtest - Resource based test framework
There are many unit-test frameworks in rust. This framework focuses on integration-testing, that means external software, not necessarily written in rust.
rtest works by using stateful resources.
It uses macros to build a executable binary that can handle all your filters and returns a nice output.
Imagine you are hosting a webshop and want to verify it works with integration-tests.
const SHOP: &str = "http://shop.example.com";
async
async
async
async
The test framework will know that in order to test the check_order function it first needs to have a Order.
But the only way to generate such an order is through the place_order test.
cancel_order will consume the order and no longer make it useable.
Yes, you can trick it by removing all tests that generate an Order - the framework will notice that on runtime and fail.
It might be possible that multiple routes are valid to test all functions, in case of an error the route it took will be dumped.
Let's assume checking an order with water will fail.
The framework might decide to create another Order with pizza because it cannot verify deletion otherwise, tests might be executed multiple times.
rtest Results:
[✓]
[✓] delete_file
[✓] create
[✓] create_file
[✓] setup_fileinfo
[x] read
[✓] read_metadata
[x] test_that_should_fail
[x] test_that_should_panic - 177ms
Total Tests: 6. Total Runs: 7 Fails: 2
Failed
Features:
- Allow any Input/Output Resources (up to 5)
- Custom Errors
- Custom Context (though rarely needed)
- Reorder execution and no longer depend on random execution model
- Multithread support
- Async Support
- Automatically create new Resources on demand
- Capture Panics (needed for asserts)
- Capture println
- Capture logs
- External Log Capturing, e.g. Annotate a Test with a custom string, which is propagated to an Adapter which then does work in parallel to a test. if a test fails the logs are stored, if the tests succeeds the logs are dropped. E.g. We specify a kubernetes watcher and say, watch the Pod "foobar" during a test execution.
- Markdown Output
- Json Input/Output to persistent runs, retry runs, compare with previous runs