-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[JUnit Platform] Support cucumber.features property #2498
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## main #2498 +/- ##
============================================
+ Coverage 83.70% 83.76% +0.05%
- Complexity 2677 2688 +11
============================================
Files 319 319
Lines 9438 9471 +33
Branches 916 917 +1
============================================
+ Hits 7900 7933 +33
Misses 1201 1201
Partials 337 337
Continue to review full report at Codecov.
|
...atform-engine/src/main/java/io/cucumber/junit/platform/engine/DiscoverySelectorResolver.java
Outdated
Show resolved
Hide resolved
Amazing - just what I need! |
45db487
to
3983d4e
Compare
mpkorstanje
commented
Mar 9, 2022
...atform-engine/src/main/java/io/cucumber/junit/platform/engine/DiscoverySelectorResolver.java
Outdated
Show resolved
Hide resolved
mpkorstanje
commented
Mar 9, 2022
...atform-engine/src/main/java/io/cucumber/junit/platform/engine/DiscoverySelectorResolver.java
Outdated
Show resolved
Hide resolved
mpkorstanje
commented
Mar 9, 2022
junit-platform-engine/src/main/java/io/cucumber/junit/platform/engine/FeatureResolver.java
Outdated
Show resolved
Hide resolved
54ae0d5
to
0b72aa2
Compare
JUnit 5 support is still anything but first class (junit-team/junit5#2849). As such users do need a quick and easy way to select feature files from the commandline i.e: ``` mvn test -Dcucumber.features=path/to/example.feature ``` When enabled, other discovery selectors will be ignored. Of all possible options is the least-worst solution. Additionally a warning is logged prompting users to request better support. The relevant issues to request/support/sponsor are: - IDEA - https://youtrack.jetbrains.com/issue/IDEA-227508 - https://youtrack.jetbrains.com/issue/IDEA-276463 - https://youtrack.jetbrains.com/issue/IDEA-276477 - Eclipse - No issue exists (yet). - Maven Surefire - https://issues.apache.org/jira/browse/SUREFIRE-1724 - Gradle - gradle/gradle#4773
0b72aa2
to
946e6bc
Compare
mpkorstanje
added a commit
that referenced
this pull request
Dec 12, 2023
Maven Surefire and Gradle do not (yet?) fully support the JUnit Platform API[1]. To work around this problem the `cucumber.features` can be used. However, because Maven Surefire and Gradle only attempt to discover class based tests, they do expect a class source. As a result of this missing source, Maven Surefire will not report on the executed tests while Gradle reports the tests as having been executed by an "Unknown Class". By having the Cucumber TestEngine pretend to have a ClassSource when `cucumber.features` is used both these problems go away. 1. #2498
7 tasks
mpkorstanje
added a commit
that referenced
this pull request
Dec 13, 2023
Maven Surefire and Gradle do not (yet?) fully support the JUnit Platform API[1]. To work around this problem the `cucumber.features` can be used. However, because Maven Surefire and Gradle only attempt to discover class based tests, they do expect a class source. As a result of this missing source, Maven Surefire will not report on the executed tests while Gradle reports the tests as having been executed by an "Unknown Class". By having the Cucumber TestEngine pretend to have a ClassSource when `cucumber.features` is used both these problems go away. 1. #2498
mpkorstanje
added a commit
that referenced
this pull request
Dec 13, 2023
Maven Surefire and Gradle do not (yet?) fully support the JUnit Platform API[1]. To work around this problem the `cucumber.features` can be used. However, because Maven Surefire and Gradle only attempt to discover class based tests, they do expect a class source. As a result of this missing source, Maven Surefire will not report on the executed tests while Gradle reports the tests as having been executed by an "Unknown Class". By having the Cucumber TestEngine pretend to have a ClassSource when `cucumber.features` is used both these problems go away. 1. #2498
mpkorstanje
added a commit
that referenced
this pull request
Dec 14, 2023
Maven Surefire and Gradle do not (yet?) fully support the JUnit Platform API[1]. To work around this problem the `cucumber.features` can be used. However, because Maven Surefire and Gradle only attempt to discover class based tests, they do expect a class source. As a result of this missing source, Maven Surefire will not report on the executed tests while Gradle reports the tests as having been executed by an "Unknown Class". By having the Cucumber TestEngine pretend to have a ClassSource when `cucumber.features` is used both these problems go away. 1. #2498 Co-authored-by: Marit van Dijk <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Usually it not necessary to use the
cucumber.features
property. See the notes section below.JUnit 5 support is still anything but first class junit-team/junit5#2849. As such users
do need a quick and easy way to select feature files from the
commandline i.e:
When enabled, other discovery selectors will be ignored. As such it would be prudent to select only the cucumber engine for execution with
-Dsurefire.includeJUnit5Engines=cucumber
and enabling pretty printing with-Dcucumber.plugin=pretty
. I.e:Of all possible options is the least-worst solution. Additionally a warning is logged prompting users to request better support. The relevant issues to request/support/sponsor are:
IDEA
Eclipse
Maven Surefire
Gradle
Note: Usually it not necessary to use the
cucumber.features
property.When using the
@Suite
annotation use the JUnit 5 Suite annotations dedicated to selecting tests. I.e:@SelectClasspathResource
or@SelectFile
.When using the JUnit Platform Launcher API, use
DiscoverySelectors.selectClasspathResource
orDiscoverySelectors.selectFile
.When using the JUnit ConsoleLauncher use the
--select-file
or--select-classpath-resource
CLI options.Note: Rerun files are not (yet?) supported with JUnit 5. See: #2805.