tsundberg / gradle-cucumber-runner

A gradle plugin for running Cucumber-JVM
Apache License 2.0
20 stars 10 forks source link

Debugging: Breakpoints are not hit in IntellijIDEA #2

Closed ruslank777 closed 4 years ago

ruslank777 commented 4 years ago

Hi, I am trying to run tests by using that runner. And what I am facing is that in debug mode IntellijIdea doesn't hit the breakpoints in step definition files. In case if I am running tests via Cucumber-Java Run Configuration all breakpoints are hit. Do you have any insights on why it can happen? Thank you.

tsundberg commented 4 years ago

This is a Gradle runner whose biggest advantage is that it can run scenarios in parallell. It is not expected to be executed in debug mode from IntelliJ. I am therefore not surprised that your breakpoints aren't honored.

My solution for debugging the steps would be to run them some other way. My preferred way is to use the Junit runner. I.e. have a runner file like this:

package io.cucumber.skeleton;

import io.cucumber.junit.CucumberOptions;
import io.cucumber.junit.Cucumber;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class)
@CucumberOptions(plugin = {"pretty"})
public class RunCucumberTest {
}

I would then run that file from IntelliJ and expect breakpoints to be honored.