Cucumber Trellis
Create a test "trellis" for Cucumber.
You can create a test suite for Cucumber, with each test implemented in a file, linked to a Gherkin feature file.
Each test implements a trait CucumberTest and this test is registered in the "trellis".
Finally, all tests are executed in parallel, and the trellis waits for all tests to finish.
Installation
Usage
First, allows Cucumber to print output instead of libtest
by adding these lines in your Cargo.toml:
[[]]
= "cucumber"
= false
Then, put feature files in tests/features directory,
and put the following code in tests/cucumber.rs:
After that , in tests/tests/example.rs,
implements the trait cucumber_trellis::CucumberTest, like this:
use CucumberTest;
use World;
pub ;
// Implement here, the steps according the file `tests/features/simple-test.feature`
// ...
Don't forget the file tests/tests/mod.rs:
pub
Finally, run the tests:
Example
You have an example in the tests directory.
Macro
You can use the macro cucumber_trellis::cucumber_test to simplify the code.
The macro cucumber_test will decorate your function that will add Cucumber tests.
That function will receive a mutable reference to a CucumberTrellis object:
use ;
Currently, the macro cucumber_test can receive the following parameters:
features: The path to the features directory, here for exampletests/features.executor: The path of a function to execute asyncs.use_tokio: The generated functionmainwill use thetokioruntime; Tokio should be added indev-dependencies.
These parameters are optional, and the parameters use_tokio and executor are mutually exclusive,
as use_tokio forces the use of the tokio as executor.
So the example above won't compile, it's just to show the usage.
The default executor is futures::executor::block_on,
therefore the dependency futures must be added in Cargo.toml if no executor is specified in parameters.