I have two domain specific junit5 platform cucumber test suites.
A:
@Suite
@IncludeEngines("cucumber")
@SelectPackages("de.bla.blubb1")
@SelectClasspathResource("de/bla/blubb1")
@ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "de.bla.blubb1")
@ConfigurationParameter(key = PLUGIN_PUBLISH_QUIET_PROPERTY_NAME, value = "true")
@ConfigurationParameter(key = PLUGIN_PROPERTY_NAME, value = "pretty,json:target/blubb1cucumber.json")
public class RunBlubb1CucumberTest
{
// nichts zu tun
}
and B:
@Suite
@IncludeEngines("cucumber")
@SelectPackages("de.bla.blubb2")
@SelectClasspathResource("de/bla/blubb2")
@ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "de.bla.blubb2")
@ConfigurationParameter(key = PLUGIN_PUBLISH_QUIET_PROPERTY_NAME, value = "true")
@ConfigurationParameter(key = PLUGIN_PROPERTY_NAME, value = "pretty,json:target/blubb2cucumber.json")
public class RunBlubb2CucumberTest
{
// nichts zu tun
}
The stepdefiniton classes are in the same package as each of the suite-classes. In both stepdefintions classes are some duplicate step definitions (just the method body is different) and used in the feature files.
@Gegebensei("Example")
public void gegebenSeiExample(Map<String, Map<String, String>> map)
{
for (Entry<String, Map<String, String>> e : map.entrySet())
{
blabla.put(e.getKey(), new BlaMock(e.getValue()));
}
}
If i run both in intellij idea by selecting just both suite classes, all tests run succesful. If i run all tests i get duplicate step execptions. (also in eclipse)
DuplicateStepDefinitionException
io.cucumber.core.runner.DuplicateStepDefinitionException: Duplicate step definitions in de.bla.blubb1.StepDefsEingangsparameter.erstelle() and de.bla.blubb2.StepDefsEingangsparameter.erstelle()
at io.cucumber.core.runner.CachingGlue.lambda$prepareGlue$3(CachingGlue.java:278)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at io.cucumber.core.runner.CachingGlue.prepareGlue(CachingGlue.java:272)
at io.cucumber.core.runner.Runner.runPickle(Runner.java:72)
at io.cucumber.junit.platform.engine.CucumberEngineExecutionContext.lambda$runTestCase$4(CucumberEngineExecutionContext.java:112)
at io.cucumber.core.runtime.CucumberExecutionContext.lambda$runTestCase$5(CucumberExecutionContext.java:136)
at io.cucumber.core.runtime.RethrowingThrowableCollector.executeAndThrow(RethrowingThrowableCollector.java:23)
at io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:136)
at io.cucumber.junit.platform.engine.CucumberEngineExecutionContext.runTestCase(CucumberEngineExecutionContext.java:109)
at io.cucumber.junit.platform.engine.NodeDescriptor$PickleDescriptor.execute(NodeDescriptor.java:168)
at io.cucumber.junit.platform.engine.NodeDescriptor$PickleDescriptor.execute(NodeDescriptor.java:90)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
I already tried a lot with forking on a class basis (in the run configuration) but this slows the other tests way too much down and other stuff. The step definitions should stay as they are (requirement). I know i could just rename them.
Is there a way to run those two suites "separately"? (without to change maven config and run config) I only want those two cucumber suite-classes to run separately (in diffrent threads? jvms?), preferably defined with an annotation or configuration property somewhere.