I have a Java Framework that contains some Cucumber Feature Files. It also contains some Karate Feature Files.
I have separate runners for each type of Feature File and both sets of tests run successfully.
However, when I view the Feature Files in Intellij...it always looks as though either the Cucumber or the Karate Step definitions cannot be found.
If I add ONLY a Karate dependency to the pom:
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-junit5</artifactId>
<version>1.1.0</version>
<scope>test</scope>
</dependency>
Then the karate steps in the Karate Feature Files are recognised but the Cucumber Steps in the Cucumber Feature Files are NOT recognised.
If I add ONLY a Cucumber dependency to the pom:
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>7.2.3</version>
</dependency>
Then the Cucumber steps in the Cucumber Feature Files are recognised but the Karate Steps in the Karate Feature Files are NOT recognised.
Is there a way for BOTH to be recongnised at the same time?
I think it is a problem with the step definition location but I'm not sure how to overcome it.
CodePudding user response:
IDEA uses a simple heuristics to determine which Cucumber version to use. If the latest version is detected, that one is used.
However Karate depends on the older versions of Cucumber. So when using Karate and a recent version of Cucumber IDEA will ignore Karate.
To fix this properly Peter would have to provide his own step definition annotations. And then IDEA could use those next to the ones from Cucumber.
But that means waiting for Jetbrains which I imagine Peter is loath to do.