I currently try to implement parallel_tests for our Cucumber + Watir-WebDriver acceptance tests. As far it goes great.
However, we got used to nice HTML reports from Cucumber with embedded screenshots of failed scenarios. Cucumber creates reports as a single HTML file with all the features. But with parallel_tests, this HTML file is overwritten with the last called Cucumber process and thus incomplete.
Is it possible to generate several HTML reports or generate HTML reports per features file?
This is why running tests in parallel is important and it is better to always start an automation project with this in mind. In order to run one or several .feature files, an empty class is created. It is annotated with @RunWith (Cucumber.class).
The Main class in the io.cucumber.core.cli package is used to execute the feature files. You can run this class directly from the command line; in that case, there is no need to create any runner class. The usage options for this class are mentioned here. The --threads option needs to be set to a value greater than 1 to run in parallel.
Cucumber-JVM allows parallel execution across multiple threads since version 4.0.0. There are several options to incorporate this built-in feature in a Cucumber project. You can do so by using JUnit, TestNG or CLI. Cucumber can be executed in parallel using TestNG and Maven test execution plugins by setting the dataprovider parallel option to true.
Add a cucumber runner by extending the AbstractTestNGCucumberTests class and overriding the scenarios method. Set the parallel option value to true for the DataProvider annotation. Add cucumber.properties under src/test/resources and add the below instruction in the file.
Put
default: --format html --out report<%= ENV['TEST_ENV_NUMBER'] %>.html
in ./config/cucumber.yml
. Whey you run the tests, you will find report.html
, report2.html
(...) files in project root.
I don't think you have this out of the box. What we ended up doing was writing a new formatter.
https://github.com/cucumber/cucumber/wiki/Custom-Formatters
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With