有没有办法在 Maven 的集成测试阶段进行 运行 空手道测试?

Is there a way to run Karate test during maven's integration test phase?

有没有办法在 Maven 的集成测试阶段进行 运行 空手道测试?似乎 surefire 插件被硬编码到空手道中。我试图使用故障安全插件覆盖它,但没有成功。我不希望 运行 与单元测试一起进行测试。

提前致谢!

It seems that surefire plugin is hardcoded into Karate

我不确定你是从哪里得到这种印象的,但是不,surefire 插件没有硬编码到空手道中。

请记住,通过 surefire not 运行 JUnit 测试的最简单方法是 not 使用 *Test.java 命名约定。

我认为适合您的解决方案很简单,无论哪个 JUnit 测试都是空手道测试的 "entry-point"(parallel runner is recommended) - just use the failsafe naming conventions.

然后,只需按照示例包含故障安全插件,它就应该可以工作。如果你无法让它工作(不太可能),那么你应该看看 maven profiles.

编辑:另请参阅此评论:

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.