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

Cucumber command line options not overriding #2190

Closed
a1dutch opened this issue Dec 14, 2020 · 4 comments · Fixed by #2191
Closed

Cucumber command line options not overriding #2190

a1dutch opened this issue Dec 14, 2020 · 4 comments · Fixed by #2191

Comments

@a1dutch
Copy link

a1dutch commented Dec 14, 2020

Describe the bug
The cucumber.plugin command line options are not overriding the ones set on the CucumberOptions.

with the following runner

@RunWith(Cucumber.class)
@CucumberOptions(
    plugin = {
        "pretty",
        "summary",
        "html:target/cucumber-html/index.html",
        "json:target/cucumber-report.json",
        "junit:target/cucumber.xml"
    },
    features = "classpath:features",
    tags = "not @manual and not @ignored")
public class TestRunner {
    // not required
}

when the following maven command is ran

./mvnw --no-transfer-progress clean test -Dcucumber.plugin=pretty

gives the following error

io.cucumber.core.exception.CucumberException: Only one plugin can use STDOUT, now both pretty and pretty use it. If you use more than one plugin you must specify output path with pretty:DIR|FILE|URL

Removing pretty from the CucumberOptions makes it work from the command line, but does not add the pretty formatter when run from eclipse.

Expected behavior
Command line options should override the CucumberOptions annotation

Your Environment

  • Cucumber 6.4.0 +
  • MacOS
  • Maven 3.6
@mpkorstanje
Copy link
Contributor

mpkorstanje commented Dec 14, 2020

The cucumber.plugin options are merged rather then overridden like most others. That could do with some better documentation.

I don't quite understand the practical problem you are facing though. Are you intentionally trying to disable the plugins specified in CucumberOptions by providing only pretty via cucumber.plugin?

@a1dutch
Copy link
Author

a1dutch commented Dec 14, 2020

We have a common pipeline to run all our test jobs in jenkins that tries to enable the pretty plugin and some others.

The pretty plugin is also specified in the CucumberOptions.

If these are merged shouldnt the check be done after merging them together?

@mpkorstanje
Copy link
Contributor

The merge is pretty naive. It doesn't filter out duplicates, but that is something that could be implemented.

mpkorstanje added a commit that referenced this issue Dec 14, 2020
It is possible to declare duplicate plugins. Either through `@CucumberOptions`,
or `cucumber.plugin`, ect or a combination thereof. This can be used to ensure
certain plugins are always active during a build in CI.

Merging duplicate plugin options should ensure that plugins are not
instantiated twice with the same output.

Fixes: #2190
mpkorstanje added a commit that referenced this issue Dec 14, 2020
It is possible to declare duplicate plugins. Either through `@CucumberOptions`,
or `cucumber.plugin`, ect or a combination thereof. This can be used to ensure
certain plugins are always active during a build in CI.

Merging duplicate plugin options should ensure that plugins are not
instantiated twice with the same output.

Fixes: #2190
@a1dutch
Copy link
Author

a1dutch commented Dec 14, 2020

Wow @mpkorstanje that was quick! Thankyou very much

This was referenced Mar 15, 2021
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

Successfully merging a pull request may close this issue.

2 participants