-
-
Notifications
You must be signed in to change notification settings - Fork 2k
[JUnit] Implement Cucumber as a Junit Platform Engine #1530
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
Merged
Conversation
This file contains hidden or 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
To avoid having to deal with path separators everywhere all paths have their separators replaced with a forward slash while parsing runtime options. To make this easier all rerun files are also read while parsing runtime options. As a result we can now also emit an error when a feature file that explicitly included (e.g. /path/to.feature) does not exist.
mpkorstanje
added a commit
that referenced
this pull request
Nov 21, 2019
Adds Cucumber implementation of JUnit Platforms TestEngine that will discover, filter and execute scenarios. Fixes: #1149 Unlike previous versions of JUnit, JUnit 5 is composed of several different modules from three different sub-projects. ``` JUnit 5 = JUnit Platform + JUnit Jupiter + JUnit Vintage ``` The JUnit Platform serves as a foundation for launching testing frameworks on the JVM. It also defines the TestEngine API for developing a testing framework that runs on the platform. By implementing Cucumber as a TestEngine we can benefit from existing implementations that use the JUnit Platform. This will make it easier to develop tooling for Cucumber - any tooling that supports the Junit Platform will automatically support the execution of Cucumber Scenarios.
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.
Summary
Adds Cucumber implementation of JUnit Platforms
TestEngine
that will discover, filter and execute scenarios.Fixes: #1149
Details
Motivation and Context
The motivation for this PR is two fold. To reduce the amount of configuration needed to run Cucumber and to facilitate developers of tooling that integrates Cucumber into test runners and IDE's.
Facilitating tooling
Unlike previous versions of JUnit, JUnit 5 is composed of several different modules from three different sub-projects.
The JUnit Platform serves as a foundation for launching testing frameworks on the JVM. It also defines the TestEngine API for developing a testing framework that runs on the platform. By implementing Cucumber as a
TestEngine
we can benefit from existing implementations that use the JUnit Platform. This will make it easier to develop tooling for Cucumber - any tooling that supports the Junit Platform will automatically support the execution of Cucumber Scenarios. For example:Note: Support is limited to running cucumber tests. Syntax highlighting, and other editor specific features are not supported.
Reduce boiler plate
In the ideal situation a project only contains step definitions and feature files. Currently however some additional setup is needed in the form of a runner class annotated with
@CucumberOptions
. By using the JUnit platform the presence of Cucumber on the class path will make it so that tooling can automatically execute features.Coincidentally the JUnit Platform only allows a single source of configuration. This makes it clear in which configuration cucumber will be executed. This is an improvement over the current hierarchy of environment and annotation based variables.
How Has This Been Tested?
Work in progress
ConfigurationParameters
toRuntimeOptions
inCucumberEngineExecutionContext
. This will require some refactoring ofRuntimeOptions
. Note that not all options are valid in this context. Valid options are:--dry-run
,--monochrome
,--strict
,--plugin
and--glue
.ModuleSelector
inDiscoverySelectorResolver
ClasspathRootSelector
inDiscoverySelectorResolver
UniqueIdSelector
inDiscoverySelectorResolver
UriSelector
inDiscoverySelectorResolver
.getTags
forPickleDescriptor
,ScenarioOutlineDescriptor
andFeatureFileDescriptor
.Types of changes
Checklist: