I am writing a test suite and have came across an issue. I am using cucumber and have defined multiple feature files. When I run the test pack the progress (html report and json format) of one feature file gets over-written when the next feature file execution begins.
I have multiple test classes defined that runs these feature files. I am trying to find a way I can get a single html report for all feature runs to give a consolidated view.
Sample test files for ref:
@CucumberOptions(plugin = { "pretty", "html:target/report/html",
"json:target/report/json/result.json" })
public class BaseFeature {
}
@RunWith(Cucumber.class)
@CucumberOptions(features = "classpath:test/feature/rest/query.feature"
, monochrome = true
, glue={"a.b.c.rest"})
public class RunTest1 extends BaseFeature {
}
@RunWith(Cucumber.class)
@CucumberOptions(features="classpath:test/feature/soap/book.feature"
, monochrome = true
, glue="a.b.c.soap")
public class RunTest2 extends BaseFeature {
}
Let know what can be done to have a consolidated report.
A bit late, but as committed I am posting the solution here. Cucumber has a maven plugin that can be used to generate reports.
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>${maven-cucumber-reporting.version}</version>
plugin version is currently : 3.3.0
This plugin provides some useful configuration parameters, that allows you to bind multiple test reports in json format.
A sample implementation is as follows:
<plugins> ...
<plugin>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>${maven-cucumber-reporting.version}</version>
<executions>
<execution>
<id>execution</id>
<phase>verify</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<projectName>test-report</projectName>
<outputDirectory>${project.build.directory}/bdd/report</outputDirectory>
<cucumberOutput>${project.build.directory}/report/json</cucumberOutput>
<parallelTesting>false</parallelTesting>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Configuration to be used:
cucumberOutput: Path to where all the json reports are kept after the cucumber run
outputDirectory: Path to where the html report will be generated
That's it and have fun.