Reputation: 8394
There is a similar issue here but with no answers and no progress in solving it.
I am running Selenium tests with Cucumber and with Gradle as the build tool. In Jenkins.
This is my build.gradle
file:
task cucumber() {
dependsOn assemble, compileTestJava
doLast{
javaexec {
main = "cucumber.api.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = ['--plugin', 'pretty', '--glue', 'stepmethods', 'src/main/java/features', '--tags', 'not @proba and not @test and not @rucno and not @nedovrseno']
}
}
}
I wanted to exclude some scenarios from the feature I am testing so I added the '--tags', 'not @proba and not @test and not @rucno and not @nedovrseno'
part to Gradle task arguments.
After that (and I'm not 100% sure this is the cause) tests run fine in a Jenkins job, but the reports with Cucumber reports plugin are not getting generated.
Instead, this is the Jenkins console output:
15:09:02 BUILD SUCCESSFUL in 1m 58s
15:09:02 3 actionable tasks: 3 executed
15:09:02 Build step 'Invoke Gradle script' changed build result to SUCCESS
15:09:02 [CucumberReport] Using Cucumber Reports version 4.6.0
15:09:02 [CucumberReport] JSON report directory is ""
15:09:02 [CucumberReport] Copied 1 json files from workspace "C:\Users\me\.jenkins\workspace\Project Name" to reports directory "C:\Users\me\.jenkins\jobs\Project Name\builds\12\cucumber-html-reports\.cache"
15:09:02 [CucumberReport] Copied 4 properties files from workspace "C:\Users\me\.jenkins\workspace\Project Name" to reports directory "C:\Users\me\.jenkins\jobs\Project Name\builds\12\cucumber-html-reports\.cache"
15:09:02 [CucumberReport] Processing 1 json files:
15:09:02 [CucumberReport] C:\Users\me\.jenkins\jobs\Project Name\builds\12\cucumber-html-reports\.cache\report.json
15:09:02 [CucumberReport] Missing report result - report was not successfully completed
15:09:02 [CucumberReport] Build status is left unchanged
15:09:02 Finished: SUCCESS
So, the files are processed, but the report is missing. What could be the problem?
Upvotes: 1
Views: 3318
Reputation: 2819
EDIT
Added second '--plugin' to string to account for the OP's finding.
Removed additional examples.
Try
task cucumber() {
dependsOn assemble, compileTestJava
doLast{
javaexec {
main = "cucumber.api.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = ['--plugin', 'pretty', '--plugin', 'html:some/dir', '--glue', 'stepmethods', 'src/main/java/features', '--tags', 'not @proba and not @test and not @rucno and not @nedovrseno']
}
}
}
You didn't specify which report you wanted nor where you wanted it generated. This gives you pretty and html.
Upvotes: 1