Skip to content

Cucumber test results don't display examples name or steps #1360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ghost opened this issue May 4, 2018 · 14 comments
Closed

Cucumber test results don't display examples name or steps #1360

ghost opened this issue May 4, 2018 · 14 comments

Comments

@ghost
Copy link

ghost commented May 4, 2018

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
39549955-36517c12-4e25-11e8-8d1e-cd0c92bb2f59

Executing the runner using the old info.cukes dependencies (1.2.5) produce result with example names and steps as expected.

@mpkorstanje
Copy link
Contributor

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: #263, #935, #577, #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.

@ghost
Copy link
Author

ghost commented May 4, 2018

Great, thanks for clarification. I'll take a look at picklerunners, than you for suggestion.

@ghost ghost closed this as completed May 4, 2018
@ghost
Copy link
Author

ghost commented May 4, 2018

@mpkorstanje seems like @CucumberOptions(junit = "--no-step-notifications") is not doing anything for me :(

@mpkorstanje
Copy link
Contributor

That's because I copied the wrong example. Try --step-notifications

@ghost
Copy link
Author

ghost commented May 4, 2018

@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?

@mpkorstanje
Copy link
Contributor

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.

@ghost
Copy link
Author

ghost commented May 4, 2018

@mpkorstanje Ok. Thanks for your help, really appreciate it!

@salvada
Copy link

salvada commented Jan 23, 2019

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?

@mpkorstanje
Copy link
Contributor

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.

@systemsincode
Copy link

@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.

@mpkorstanje
Copy link
Contributor

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.

@nuwaveqateam
Copy link

thanks now my junit steps are visible.

@iUdieee
Copy link

iUdieee commented Feb 7, 2020

@mpkorstanje Is there a way to do the same thing with Cucumber Ruby - @CucumberOptions(junit = "--no-step-notifications")
Thanks!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants