When using Karate 0.6.1 with cucumber. It is generating test result outputs to cucumber.json file in the path specified in the code.
It is then used for generating the cucumber reports using Masterthought.
@RunWith(Karate.class)
@CucumberOptions(monochrome = true, features = "SampleFeature.feature",
plugin = {"pretty", "html:target/site/cucumber-pretty",
"json:target/cucumber-html-reports/cucumber.json" })
But when we migrated to Karate 0.9.1 to read inputs from csv file. Now, it is failing to generate cucumber.json so the reports are failing with FileNotFoundException.
Attached the plugin for masterthought in pom.xml
<plugin>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>3.15.0</version>
<executions>
<execution>
<id>execution</id>
<phase>verify</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<!-- optional, per documentation set this to "true" to bypass
generation of Cucumber
Reports entirely, defaults to false if not specified -->
<skip>false</skip>
<!-- output
directory for the generated report -->
<outputDirectory>${project.build.directory}</outputDirectory>
<!-- optional, defaults to outputDirectory if not specified -->
<inputDirectory>${project.build.directory}/surefire-reports</inputDirectory>
<jsonFiles>
<!-- supports wildcard or name pattern -->
<param>target/cucumber-html-reports/cucumber-json-report.json</param>
</jsonFiles>
<cucumberOutput>${project.build.directory}/cucumber-html-reports/cucumber.json</cucumberOutput>
<!-- optional, defaults to outputDirectory if not specified -->
<classificationDirectory>${project.build.directory}/classifications</classificationDirectory>
<classificationFiles>
supports wildcard or name pattern
<param>sample.properties</param>
<param>other.properties</param>
</classificationFiles>
<parallelTesting>false</parallelTesting>
</configuration>
</execution>
</executions>
</plugin>
Can anyone suggests what is changed from 0.6.1 to 0.9.1?
And what should i be doing to generate cucumber.json file?
In Karate 0.9.0 onwards, the only parameters on the annotation supported are features
and tags
, nothing else. Karate is not based on Cucumber any more.
The parallel runner, will generate the JSON you are expecting in target/surefire-reports
by default. Please read this section of the docs carefully: https://github.com/intuit/karate#parallel-execution
So you have to do the following:
@RunWith(Karate.class)
@KarateOptions(features = "SampleFeature.feature")
Runner.parallel()
maven-cucumber-reporting
as a plugin
, use it as a dependency
instead, refer this: https://github.com/intuit/karate/tree/master/karate-demo#example-reportEDIT - note that in 1.0 onwards, the Cucumber JSON is not output by default: https://stackoverflow.com/a/66682940/143475