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

Provide a property name variant for each runtime option #1675

Closed
mpkorstanje opened this issue Jun 28, 2019 · 0 comments · Fixed by #1741
Closed

Provide a property name variant for each runtime option #1675

mpkorstanje opened this issue Jun 28, 2019 · 0 comments · Fixed by #1741
Labels
⚡ enhancement Request for new functionality
Milestone

Comments

@mpkorstanje
Copy link
Contributor

mpkorstanje commented Jun 28, 2019

Summary

It is possible to pass properties to cucumber using CLI arguments in a property. E.g.

mvn clean test -Dcucumber.options="--strict --monochrome"

This is rather complicate, esp when multiple layers are involved and qoutes get confusing (e.x: #1596).

mvn clean test -Dcucumber.options='--strict --monochrome --tags "not @ignored"'

A better way to do this would be to provide each option individually:

mvn clean test -Dcucumber.strict=true -Dcucumber.monochrome=true -Dcucumber.tags="not @ignored"

Once this is available we deprecate cucumber.options.

Possible Solution

In develop-v5 the CucumberPropertiesParser.parse method is provided with a map containing properties from either either a cucumber.properties file, environment variables, or system properties.

After parsing cucumber.options an options builder is created. When a property is present the builder can be used to set the matching option to the right value.

Supported properties:

cucumber.glue=<separated list of paths>  #using OS appropriate seperator
cucumber.features=<separated list of paths>   #using OS appropriate seperator
cucumber.tags=<single tag expression>
cucumber.name=<regex>
cucumber.ansi-colors.disabled=<boolean>
cucumber.execution.dry-run=<boolean>
cucumber.execution.strict=<boolean>
cucumber.execution.parallel.config.fixed.parallelism=<int>
cucumber.execution.limit=<positive integer>
cucumber.execution.order=<reverse|random|random:seed>
cucumber.snippet-type=<underscore|camelcase>
cucumber.wip=<boolean>

Property names where possible should match those used by JUnit 5: https://github.com/cucumber/cucumber-jvm/blob/junit-jupiter/junit-platform-engine/src/main/java/io/cucucumber/jupiter/engine/Constants.java

To document this properly with Java doc please take hints from:

https://junit.org/junit5/docs/current/api/constant-values.html
https://junit.org/junit5/docs/current/api/org/junit/jupiter/engine/Constants.html

@mpkorstanje mpkorstanje added ⚡ enhancement Request for new functionality 🙏 help wanted Help wanted - not prioritized by core team good first issue Good for newcomers labels Jun 28, 2019
@mpkorstanje mpkorstanje added this to the 5.x.x milestone Jun 28, 2019
@mpkorstanje mpkorstanje modified the milestones: 5.x.x, 5.0.0 Aug 11, 2019
@mpkorstanje mpkorstanje removed 🙏 help wanted Help wanted - not prioritized by core team good first issue Good for newcomers labels Aug 25, 2019
mpkorstanje added a commit that referenced this issue Sep 5, 2019
Adds properties for all CLI options. Removes the ability to load rerun files
from the class-path. There appears to be no use case and it significantly
simplifies the implementation.

## Details

Adds:

```
cucumber.ansi-colors.disabled
cucumber.execution.dry-run
cucumber.execution.limit
cucumber.execution.order
cucumber.execution.parallel.config.fixed.parallelism
cucumber.execution.strict
cucumber.execution.wip
cucumber.feature
cucumber.rerun-file
cucumber.filter.name
cucumber.filter.tags
cucumber.glue
cucumber.object-factory
cucumber.plugin
cucumber.snippet-type
```

## Motivation and Context

It is possible to pass properties to cucumber using CLI arguments in a property.
E.g:

```
mvn clean test -Dcucumber.options="--strict --monochrome"
``` 
This is rather complicate, esp when multiple layers are involved and quotes get
confusing (e.x: #1596). 

```
mvn clean test -Dcucumber.options='--strict --monochrome --tags "not @ignored"'
``` 

A better way to do this would be to provide each option individually:

```
mvn clean test -Dcucumber.strict=true -Dcucumber.ansi-colors.disabled=true -Dcucumber.filter.tags="not @ignored"
```

Closes #1675
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚡ enhancement Request for new functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant