有没有办法告诉 Surefire 跳过某个包中的测试?
像下面这样的东西。
我想要一种方法来跳过 Surefire 中的 dao 测试。尽量避免定义套件的开销。
对于 CI,我希望每晚运行所有测试,并另外进行 5 分钟的 SCM 轮询,仅运行“快速”测试。
mvn -DskipPattern=**.dao.** test
Something like the following.
I would like a way to skip my dao tests in surefire. Trying to avoid overhead of defining Suites.
With CI I'd like to have one nightly that runs all tests and another 5 minute poll of SCM that runs only 'fast' tests.
mvn -DskipPattern=**.dao.** test
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
让我扩展肖恩的答案。这就是您在 pom.xml 中设置的内容:
然后在 CI 中像这样启动它们:
就是这样。
Let me extend Sean's answer. This is what you set in
pom.xml
:Then in CI you start them like this:
That's it.
当然,没问题:
参考:
(排除可以不能通过命令行进行配置,因此如果您想有条件地打开此行为,您必须定义一个配置文件并在命令行上激活它)
Sure, no problem:
Reference:
(The excludes can not be configured via command line, so if you want to turn this behavior on conditionally, you will have to define a profile and activate that on the command line)
可以使用命令行排除测试;使用
!
进行排除。注意:我不确定,但可能需要 2.19.1 或更高版本的 Surefire 才能工作。
示例:
这不会运行
TestHCatLoaderEncryption
排除包:
这也可以与正向过滤器结合使用。以下将运行 0 个测试:
请参阅 Maven Surefire 文档< /a>.
It is possible to exclude tests using the commandline; using
!
to exclude.Note: I'm not sure but possibly needs 2.19.1 or later version of surefire to work.
Examples:
This will not run
TestHCatLoaderEncryption
Exclude a package:
This can be combined with positive filters as well. The following will run 0 tests:
See the Maven Surefire docs.