Cucumber/gradle example not generating report?

11,573

Solution 1

The class name changed depending on the version of Cucumber you are using. It changed from json-pretty to json.

Solution 2

When running the 'cucumber' task on this example the generated cucumber report is located at 'build/cucumber-html-report/index.html'. Running the 'test' task fails as it seems that gradle has problems to create the test report for the cucumber created tests (file name contains spaces) I need to dig a bit into this to see how this can be fixed in gradle.

cheers,

René

Solution 3

The cucumber-jvm-example doesn't do reporting using gradle cucumber, but does do it with gradle test. However, gradle test will have a couple issues, namely showing a "null" test of sorts.

A workaround to this, if need be, is to add the formats to the args of the javaexec that runs cucumber. For example, in build.gradle:

javaexec {
    main = "cucumber.api.cli.Main"
    classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
    args = ['--format', 'html:cucumber-html-report', '-f', 'pretty', '--glue', 'gradle.cucumber', 'src/test/resources']
}
Share:
11,573
Depressio
Author by

Depressio

Updated on June 05, 2022

Comments

  • Depressio
    Depressio almost 2 years

    I'm investigating using gradle and cucumber together, and found this lovely example in cucumber's github.

    So, I cloned the repository and ran it myself. It failed, as it's configured to do, but I couldn't find the HTML or JSON report that it appears to be configured to output. I say appear because I'm brand new to cucumber, but this class would seem to indicate where it'll put it:

    @RunWith(Cucumber.class)
    @Cucumber.Options(format = {"pretty", "html:build/cucumber-html-report", "json-pretty:build/cucumber-report.json"})
    public class RunCukesTest {
    
    }
    

    However, it's not appearing in the build directory after running gradle cucumber.There's no cucumber-html-report directory, not is there a cucumber-report.json file. I'm running it with Java 7 and Gradle 1.6, if it matters.

    Ideas? Is this a known issue with the Cucumber/Gradle integration?