I have two feature files: first/first.feature
and second/second.feature
.
Also, I have two step definitions files, which are in package1
and in package2
respectively.
So I can run first (or second) feature test with specific glue
and features
configuration.
But if I want to run both features I get cucumber.runtime.DuplicateStepDefinitionException
.
Can I create such configuration that enables me to run all my feature tests? Maybe with providing glue
-feature
pairs (or map?).
BTW I use this gradle-cucumber-plugin.
This is how Cucumber works; all stepdefinitions will be loaded and cannot contain duplicates (or else, how would Cucumber know which to use). Tying your step definitions to a particular feature, is actually considered an anti-pattern: https://docs.cucumber.io/guides/anti-patterns/#feature-coupled-step-definitions If the steps are in fact the same, consider merging your stepdefinitions. If they should in fact be different, consider using different language for each step.
If you do have a reason to run different features with different steps (for instance, one against a UI, another against an API), you could specify different runners with different configurations and run all the runners to run all the tests.