Running Cucumber with JUnit 5 works ok as long as all feature files are run.
@Suite
@IncludeEngines("cucumber")
@ConfigurationParameter(key = Constants.FEATURES_PROPERTY_NAME, value = "src/main/features")
@ConfigurationParameter(key = Constants.GLUE_PROPERTY_NAME, value = "com/nedap/healthcare/administration/cucumber/glue")
@ConfigurationParameter(key = Constants.PLUGIN_PROPERTY_NAME, value = "pretty, html:target/cucumber.html")
@ConfigurationParameter(key = Constants.JUNIT_PLATFORM_NAMING_STRATEGY_PROPERTY_NAME, value = "long")
public class CucumberRunner {
}
But I you want to run just one feature
mvn compile test -Dcucumber.features=.../some.feature
Then that feature is executed, immediately followed by all features. This is best visible if print statements are placed in the before and after scenario hooks:
BeforeAll
Before
After
Before
After
AfterAll
[INFO] Running com.nedap.healthcare.administration.cucumber.CucumberRunner
BeforeAll
And then things start to go wrong, because the BeforeAll is not reentrant. (But that is not the problem, it should not be executed again.)
Interestingly the [INFO] line is not present before the first BeforeAll. It seems JUNit 5's Suite annotation is not working as it should.
Any suggestions what may be wrong?