-1

Have simple cucumber feature with related auto-test (gradle-selenide) and would like to get 'pretty' cucumber html report.

build.gradle:

plugins {
    id 'java'
    id "com.github.spacialcircumstances.gradle-cucumber-reporting" version "0.1.24"
}


cucumberReports {
    outputDir = file("$buildDir")
    reports = files("$buildDir/cucumber-reports/report.json")
}


group 'org.example'
version '1.0-SNAPSHOT'


repositories {
    mavenCentral()
    maven {
        url "https://plugins.gradle.org/m2/"
    }
}

dependencies {
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'

    testImplementation 'io.cucumber:cucumber-java:7.2.3'
    testImplementation 'io.cucumber:cucumber-junit:7.2.3'

// https://mvnrepository.com/artifact/com.codeborne/selenide
    implementation group: 'com.codeborne', name: 'selenide', version: '6.4.0'
// https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager
    implementation group: 'io.github.bonigarcia', name: 'webdrivermanager', version: '5.1.1'

}

test {
    systemProperty("webdriver.chrome.driver", "path to chromedriver")
    systemProperty "cucumber.options",     )
    useJUnitPlatform()
}

RunCucumberTest.java

@RunWith(Cucumber.class)
@CucumberOptions(
        plugin = {"pretty", "html:build/cucumber-reports/html-report.html", "json:build/cucumber-reports/json-report.json"},
        features = "src/test/resources/features",
        glue = "src/test/java/steps"
)


public class RunCucumberTest {


}

after execution of feature - (even with clean) - no report created on manual execution of generateCucumberReports getting error:

  • What went wrong: Execution failed for task ':generateCucumberReports'.

No test files found

John Wind
  • 1
  • 1
  • You've got the wrong combination of dependencies. Have a look at https://github.com/cucumber/cucumber-java-skeleton – M.P. Korstanje Apr 28 '22 at 23:34
  • just checked your example, build.gradle and pom - and didn'tfind any relation of cucumber-reports.. could you please specify where i could find them? – John Wind Apr 29 '22 at 10:52
  • You have other problems in your setup that you'll have to fix first. Too many to enumerate in detail. Start with the skeleton then expand step by step. – M.P. Korstanje Apr 29 '22 at 17:42
  • you could be right... but main auto-test is running w/o ANY issues.. which leads me to idea that even "too many to enumerate" doesn't affect. if you have working configuration for cucumber-reports - please share it – John Wind Apr 29 '22 at 20:18
  • If your cucumber tests are running it's definitely not due to the configuration in your `build.gradle` or `RunCucumberTest`. – M.P. Korstanje Apr 29 '22 at 23:45
  • Do realize that if your current configuration is not used to run cucumber then any configuration added will have no effect and your reporting problem will persist. – M.P. Korstanje Apr 30 '22 at 11:47
  • ok... could you provide expamle of configuration which should be used (including cucumber-reporting)? – John Wind Apr 30 '22 at 16:42

1 Answers1

0

found answer on other forum. If someone would face with same issue here is the solution:

a) build.gradle update:

testImplementation "io.cucumber:cucumber-java8:$cucumber"
testImplementation "io.cucumber:cucumber-junit:$cucumber"
testImplementation "io.cucumber:cucumber-junit-platform-engine:$cucumber"

$cucumber = find latest version on MavenRepository

b) create new cucumber.properties file under scr/test/resources with:

configurations {
    cucumberRuntime {
        extendsFrom testImplementation
    }
}

tasks.register('cucumber') {
    dependsOn assemble, testClasses
    doLast {
        javaexec {
            main = 'io.cucumber.core.cli.Main'
            classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
            args = ['--glue', 'com.tests', 'src/test/resources']
        }
    }
}

if report wouldn't be created automatically - use Terminal > gradlew cucumber

John Wind
  • 1
  • 1