What I do:
- Set up fresh Cucumber maven project using "cucumber-archetype" from io.cucumber in Eclipse 2022-09
- Set break points in StepDefinition java source
- Run "Debug as Cucumber Feature" on feature file open in editor**
- Stepfilters disabled to make sure I'm not filtering anything out
What happens:
"Step into" moves ahead as with normal debugging, but does not go into any source to show line by line which java code is executing.
Expected:
"Step into" to go into source files to show line by line which code is executing, just as happens doing any other debugging with junit5 tests.
What I have tried:
- Converting to Cucumber nature
- Did maven update project
Project content
A test project contains these test scope dependencies, beyond imports cucumber-bom and junit-bom:
- cucumber-java 7
- cucumber-junit-platform-engine 7
- junit-platform-suite 1.9.1
- junit-jupiter 5.9.1
…so nothing more complicated than a base project is needed to get this behavior.
My questions:
- Are my expectations of step debugging here unreasonable?
- Have I perhaps missed some vital set up step for a cucumber project in Eclipse? Please note I have basically described above what set up I've done as this is an archetype.
- If not, how could I set it up to allow stepping into code also when running a Cucumber feature file in debug mode?
** This is the only way to execute the feature file in Eclipse that I know of.
CodePudding user response:
Here's one solution: Run the Cucumber runner java source file as a JUnit test in debug mode, instead of the feature file directly:
- Right click on the Cucumber runner java source file
- Select "Debug as" > "Junit Test" in the popup menu
This method both gets the input data as well as evaluation results from the Cucumber feature file and renders test results in the JUnit view as well (albeit not 100% useful). Most importantly code stepping into source now works as expected.