Reputation: 4366
I'm trying to migrate my cucumber tests from cucumber-junit
to cucumber-junit-platform-engine
to be able to use new platform features. How do I redefine my runner to use old @CucumberOptions
. I'm investigating the issue but can't seem to find the proper way yet.
Before I used such options:
@CucumberOptions(
plugin = ...,
features = ...,
tags = ...,
glue = ...
)
Is there a straighforward way to migrate it to platform-engine?
Upvotes: 7
Views: 18789
Reputation: 12029
Until Junit5/#2416 is merged there is no 1-to-1 replacement. However if you only have a single class annotated with @CucumberOptions
adding properties to junit-platform.properties
should suffice.
EDIT: #2416 was merged and released. You can now use suites to run cucumber with different configurations. See cucumber-junit-platform docs.
Upvotes: 3
Reputation: 126
I have been looking into JUnit5 and Cucumber 7.0 the past few days, I am only adding to your own answer.. documentation is scarce, this link has been a bless and docs
you dont have to use @IncludeEngines
also notice how packages are referenced
@Suite
@SelectClasspathResource("com/rmdaw/cucumber/features")
@ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "com.rmdaw.repository")
last thing you can place configuration into test/java/resources/junit-platform.properties inside you can have something like this:
cucumber.publish.quiet=true
cucumber.glue=com.rmdaw.cucumber
cucumber.plugin=pretty,\
html:target/SystemTestReports/report.html,\
json:target/SystemTestReports/report.json,\
junit:target/SystemTestReports/junit.xml\
Upvotes: 11
Reputation: 4366
It looks like @Suite
from junit-platform-engine with proper engine should be used instead of cucumber annotations.
@Suite
@IncludeEngines("cucumber")
@SelectClasspathResource("features")
@ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "com.example")
public class RunCucumberTest {
}
Kudos to @spmason answer.
Upvotes: 2