I've ran into some unexpected results running a maven project with cucumber 2.0+. I discovered when running my tests as Junit, the immediate output doesn't display the "Examples" names or steps, instead it repeats the "Scenario outline" name for each line of "Examples" table. As practice I tried running the demo project for Screenplay pattern "TODOMVC" from https://github.com/serenity-bdd/screenplay-pattern-todomvc, using cucumber-java and cucumber-junit version from 2.0.0 to 2.4.0
I've tried executing the runner with (CucumberWithSerenity.class) as well as (Cucumber.class) And this is how the JUNIT looks in my Ecplise.
Junit report in eclipse

Executing the runner using the old info.cukes dependencies (1.2.5) produce result with example names and steps as expected.
This is intentional.
JUnit tests form a tree structure. JUnit assumes that the leaves are the actual tests. By presenting the steps as tests as was done prior to 2.x quite a few JUnit features and integrations were subtly broken: https://github.com/cucumber/cucumber-jvm/issues/263, https://github.com/cucumber/cucumber-jvm/issues/935, https://github.com/cucumber/cucumber-jvm/issues/577, https://github.com/cucumber/cucumber-jvm/issues/1120.
You can get the old behavior back for now by using @CucumberOptions(junit = "--no-step-notifications") but this option may be deprecated in the future.
If you want to improve current naming you can have a look at the PickleRunners. Specifically getPickleName.
Great, thanks for clarification. I'll take a look at picklerunners, than you for suggestion.
@mpkorstanje seems like @CucumberOptions(junit = "--no-step-notifications") is not doing anything for me :(
That's because I copied the wrong example. Try --step-notifications
@mpkorstanje awesome, this is showing the steps executed! But as far as "Examples" names go, they are still being replaced by the "Scenario Outline" name. Any quick-fix for that, or is that where picklerunners have to come in?
Perhaps. But that info might no longer be available with the change to Gherkin. Each example is compiled into it's own independent pickle. You'll have to check.
@mpkorstanje Ok. Thanks for your help, really appreciate it!
Hi @mpkorstanje, I have a problem when running with cucumber 4.2.0 my tests. I use mvn to do it. Since I updated the version when running the tests i don't see any outcome, although they are running, and also I see a huge performance problem. I tired to use the step-notifications you mentioned above to see the results when running the tests without any success I think that I made a mistake in the command line
Have you any suggestions about these two problems?
Yes please create a new issue with sufficient information to reproduce the first problem. The same for the second one, but also include any measurements you may have and if possible the results of a profiler.
@mpkorstanje
Can you point me to an example of how to use picklerunners? (link is broken)
I want to uniquify? each scenario outline example execution name. I could use an Id column and ref in scenario, but I've got 100 or so example tables to fix in that case! I guess I just need to change standard behaviour for outlines only.
My requirement is due to reporting in to test rail will give a false positive if the last example to execute passed, as as far as the junit report is concerned this is a rerun of the same test.
as as far as the junit report is concerned this is a rerun of the same test.
Have a look at the implementation of the PickleId. It's what is used internally in JUnit to uniquely identify a scenario.
thanks now my junit steps are visible.
@mpkorstanje Is there a way to do the same thing with Cucumber Ruby - @CucumberOptions(junit = "--no-step-notifications")
Thanks!
Most helpful comment
That's because I copied the wrong example. Try
--step-notifications