Skip to content

Custom predicate #2258

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
wants to merge 6 commits into from
Closed

Conversation

raulmiraoliver
Copy link

Is your pull request related to a problem? Please describe.

https://community.smartbear.com/t5/Cucumber-Open/Custom-filters/td-p/213203
My team needs a way to have scenarios filtered in a more customizable way than static tagging. This allows setting new Pickle filters.

Describe the solution you have implemented
Created a new config called customPredicate that can be set to a Predicate to filter out scenarios.

@codecov
Copy link

codecov bot commented Mar 8, 2021

Codecov Report

Merging #2258 (f7afcdf) into main (dde1d4c) will decrease coverage by 0.09%.
The diff coverage is 64.44%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #2258      +/-   ##
============================================
- Coverage     83.01%   82.91%   -0.10%     
- Complexity     2340     2348       +8     
============================================
  Files           307      310       +3     
  Lines          8324     8369      +45     
  Branches        768      774       +6     
============================================
+ Hits           6910     6939      +29     
- Misses         1110     1124      +14     
- Partials        304      306       +2     
Impacted Files Coverage Δ Complexity Δ
...ain/java/io/cucumber/junit/AnyPicklePredicate.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...c/main/java/io/cucumber/junit/CucumberOptions.java 100.00% <ø> (ø) 0.00 <0.00> (ø)
...io/cucumber/testng/AnyCucumberPicklePredicate.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
.../main/java/io/cucumber/testng/CucumberOptions.java 100.00% <ø> (ø) 0.00 <0.00> (ø)
...src/main/java/io/cucumber/core/filter/Filters.java 40.00% <14.28%> (-13.85%) 2.00 <0.00> (ø)
...o/cucumber/core/options/PicklePredicateParser.java 33.33% <33.33%> (ø) 1.00 <1.00> (?)
...ucumber/core/options/CommandlineOptionsParser.java 41.56% <100.00%> (+0.71%) 29.00 <0.00> (+2.00)
.../core/options/CucumberOptionsAnnotationParser.java 83.50% <100.00%> (+0.52%) 38.00 <1.00> (+1.00)
...ucumber/core/options/CucumberPropertiesParser.java 91.89% <100.00%> (+0.22%) 14.00 <0.00> (ø)
.../java/io/cucumber/core/options/RuntimeOptions.java 92.92% <100.00%> (+0.25%) 48.00 <2.00> (+2.00)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dde1d4c...9c26c05. Read the comment docs.

@raulmiraoliver
Copy link
Author

Getting

[ERROR] Failed to execute goal org.revapi:revapi-maven-plugin:0.13.2:check (check) on project cucumber-junit: The following API problems caused the build to fail:
[ERROR] java.class.externalClassExposedInAPI: interface io.cucumber.core.gherkin.Argument: A class from supplementary archives is used in a public capacity in the API. [io.cucumber:cucumber-gherkin:jar:6.10.1-SNAPSHOT]
[ERROR] java.class.externalClassExposedInAPI: interface io.cucumber.core.gherkin.Pickle: A class from supplementary archives is used in a public capacity in the API. [io.cucumber:cucumber-gherkin:jar:6.10.1-SNAPSHOT]
[ERROR] java.class.externalClassExposedInAPI: interface io.cucumber.core.gherkin.Step: A class from supplementary archives is used in a public capacity in the API. [io.cucumber:cucumber-gherkin:jar:6.10.1-SNAPSHOT]
[ERROR] java.class.externalClassExposedInAPI: enum io.cucumber.core.gherkin.StepType: A class from supplementary archives is used in a public capacity in the API. [io.cucumber:cucumber-gherkin:jar:6.10.1-SNAPSHOT]
[ERROR] java.class.externalClassExposedInAPI: class io.cucumber.plugin.event.Location: A class from supplementary archives is used in a public capacity in the API. [io.cucumber:cucumber-plugin:jar:6.10.1-SNAPSHOT]

Please let me know if the PR has any future so I invest time on creating classes for the API to detach it from the supplementary archives.

@mpkorstanje
Copy link
Contributor

mpkorstanje commented Mar 8, 2021

There several ways to achieve this using the frameworks Cucumber integrates with:

So 'm not sure if it is worth the additional complexity of integrating this with the core.

@raulmiraoliver
Copy link
Author

@mpkorstanje, I understand - thank you for your comment! I'll discuss with the team whether it's worth in our case to upgrade to JUnit 5, as that seems to be the most fit option.

Even if we do so, if you see any value in this PR I'm willing to invest some time on it. If not, please just say/feel free to close it.

Thanks!

@mpkorstanje
Copy link
Contributor

The offer is appreciated. Though as it stands the use case is somewhat of a niche.

Additionally loading classes by name through the CLI is something I'd like to replace with SPI (#1834) in the long term and possibly through a public API for running Cucumber (#1711).

@mpkorstanje mpkorstanje closed this Mar 8, 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 this pull request may close these issues.

2 participants