Skip to content
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

Duplicated test execution while using cucumber.features property #2761

Closed
fslevoaca-ionos opened this issue May 25, 2023 · 1 comment
Closed

Comments

@fslevoaca-ionos
Copy link

fslevoaca-ionos commented May 25, 2023

It seems tests are executed twice via the cucumber.features property.

Project to reproduce the issue: https://github.com/fslev/cucumber-showcase

Steps to reproduce the behavior:

  1. Run Cucumber test scenarios using the cucumber.features property
mvn clean test -Dcucumber.features=classpath:io/example/Feature1.feature:3

Actual:

Running scenario: Feature 1 - Scenario 1_1
Running scenario: Feature 1 - Scenario 1_1

Scenario 1_1 is executed twice.

While using tags:

mvn clean verify -Dcucumber.filter.tags="@1"

... scenario is executed correctly, only once.

Thanks

@mpkorstanje
Copy link
Contributor

mpkorstanje commented May 25, 2023

In your project Cucumber gets two test discovery/execution requests. One when Maven makes a discovery request. And a second one through the JUnit Platform Suite engine. Normally the request made by Maven fails to discover any tests because Maven only requests the discovery of classes. However by setting the cucumber.features it will discover something.

So when using cucumber.features you must ensure that there is only a single execution of the Cucumber Engine.

Ultimately this comes down to a lack of proper support for the JUnit Platform in Maven (junit-team/junit5#2849) and IDEA. If that existed you would not have to use the JUnit Platform Suite Engine to run Cucumber.

Though I'm surprised you didn't see this warning:

log.warn(
() -> "Discovering tests using the " + FEATURES_PROPERTY_NAME
+ " property. Other discovery selectors are ignored!\n" +
"Please request/upvote/sponsor/ect better support for JUnit 5 discovery selectors.\n" +
"See: https://github.com/cucumber/cucumber-jvm/pull/2498");
}

Duplicate of #2567, #2498.

@mpkorstanje mpkorstanje closed this as not planned Won't fix, can't repro, duplicate, stale May 25, 2023
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

2 participants