1
votes

Is there a way to run Karate test during maven's integration test phase? It seems that surefire plugin is hardcoded into Karate. I have tried to override it using failsafe plugin but with no luck. I don't want test to run along with unit tests.

Thank in advance!

1

1 Answers

0
votes

It seems that surefire plugin is hardcoded into Karate

I'm not sure where you got that impression, but no, the surefire plugin is not hardcoded into Karate.

Keep in mind that the simplest way to not run a JUnit test via surefire is to not use the *Test.java naming convention.

I think the solution for you is simple, whichever JUnit test is the "entry-point" for your Karate tests (the parallel runner is recommended) - just use the failsafe naming conventions.

And then, just include the failsafe plugin as per the examples and it should work. If you have trouble getting that to work (unlikely), then you should look at maven profiles.

EDIT: also see this comment: Is there a way to run Karate tests as an integration test suite against a pre-booted spring boot server?

Turns out that I cannot be done and it is a limitation of Maven, not Karate. Howto add another test source folder to Maven and compile it to a separate folder? - Here is my test project to prove it out: https://github.com/djangofan/spring-boot-hello - Thanks for leading me down what appears to have been the correct path to discover the limitation. Using Gradle would likely solve my issue but that is not an option on my project. If I use Karate for "separated integration tests", I need a separate mvn test module.