Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cucumber + parallel_tests. HTML results?

Tags:

cucumber

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?

like image 279
p0deje Avatar asked Dec 24 '11 10:12

p0deje


People also ask

Why run tests in parallel in cucumber?

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).

How to run feature files in parallel in cucumber?

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.

How do I run cucumber in parallel in JVM?

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.

How do I add a cucumber runner to a test class?

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.


2 Answers

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.

like image 121
Željko Filipin Avatar answered Oct 02 '22 02:10

Željko Filipin


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

like image 28
Bramha Ghosh Avatar answered Oct 02 '22 00:10

Bramha Ghosh