在Maven的集成测试阶段是否可以运行空手道测试? [英] Is there a way to run Karate test during maven's integration test phase?

查看:53
本文介绍了在Maven的集成测试阶段是否可以运行空手道测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Maven的集成测试阶段是否有运行空手道测试的方法?看来surefire插件已硬编码到Karate中.我尝试使用故障安全插件覆盖它,但是没有运气.我不希望测试与单元测试一起运行.

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.

提前谢谢!

推荐答案

surefire插件似乎已硬编码到空手道中

It seems that surefire plugin is hardcoded into Karate

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

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

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

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

我认为为您提供的解决方案很简单,无论JUnit测试是空手道测试的入口点"(建议使用并行流水)-只需使用故障安全命名约定.

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.

也请参见此评论:

结果证明我做不到,这是对Maven的限制,而不是空手道. 如何将另一个测试源文件夹添加到Maven并将其编译到单独的文件夹中?-这是我的测试项目,以证明这一点: https://github.com/djangofan/spring-boot-hello -感谢您引导我走下了发现限制的正确道路.使用Gradle可能会解决我的问题,但这不是我的项目的选择.如果我将空手道用于单独的集成测试",则需要一个单独的mvn测试模块.

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.

这篇关于在Maven的集成测试阶段是否可以运行空手道测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆