2

I'm using Cucumber + Gradle in Intellij and can't figure out how to debug using breakpoints. I tried the suggestions posted by other users but none of them work for me. Has anyone figured out an easy way to do this? Below is my build.gradle file.

apply plugin: 'java'
apply plugin: 'idea'

configurations {
    cucumberRuntime.extendsFrom testRuntime
}

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', 'json:build/reports/cucumber-report.json',
                    '--plugin', 'html:build/reports/cucumber-report.html',
                    '--glue', 'stepDefinitions',
                    'src/test/java']
            systemProperty "cucumber.options", 
System.getProperty("cucumber.options")
        systemProperty "url", System.properties.getProperty("url")
        systemProperty "environment", 
System.properties.getProperty("environment")
        }
    }
 }
ihossain
  • 343
  • 1
  • 8
  • 19
  • 1
    What Run/Debug configuration do you use for debugging? E.g. you can use IDE's own [Run/Debug configuration](https://www.jetbrains.com/help/idea/run-debug-configuration-cucumber-java.html) to debug [cucumber steps](https://www.jetbrains.com/help/idea/running-cucumber-tests.html) without needing to configure options in build.gradle. – Andrey Jun 04 '18 at 15:24
  • I tried that but my step definitions file isn't being recognized – ihossain Jun 05 '18 at 20:09
  • 1
    Please check this thread https://stackoverflow.com/a/47235582/2000323 – Andrey Jun 06 '18 at 05:54
  • Seems to be working now. I'm not exactly sure how but it works now – ihossain Jun 07 '18 at 23:18

0 Answers0