MiB
MiB

Reputation: 621

debug stepping java code when running cucumber feature file in Eclipse

What I do:

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:

Project content

A test project contains these test scope dependencies, beyond imports cucumber-bom and junit-bom:

…so nothing more complicated than a base project is needed to get this behavior.

My questions:

  1. Are my expectations of step debugging here unreasonable?
  2. 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.
  3. 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.

Upvotes: 0

Views: 1226

Answers (1)

MiB
MiB

Reputation: 621

Here's one solution: Run the Cucumber runner java source file as a JUnit test in debug mode, instead of the feature file directly:

  1. Right click on the Cucumber runner java source file
  2. 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.

Upvotes: 0

Related Questions