在行家prevent单元测试,但允许集成测试 [英] Prevent unit tests in maven but allow integration tests

查看:185
本文介绍了在行家prevent单元测试,但允许集成测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Maven构建中,我用的是神火插件运行一些单元测试,并且保险插件运行一些集成测试。我想一个办法,只是运行的FailSafe插件的测试。

I've a maven build in which I use the SureFire plugin to run some unit tests, and the FailSafe plugin to run some integration tests. I would like a way to run just the FailSafe plugin's tests.

这不是一个很好的解决方案,为我添加不同的配置文件或任何在聚甲醛,因为它是一个多模块的构建,我不希望有编辑每个模块的POM。

It's not a good solution for me to add different profiles or anything in the pom, because it's a multimodule build and I don't want to have to edit every module's pom.

skip.tests maven.test.skip skipTests 这阻止所有的测试,<一个href=\"http://maven.apache.org/plugins/maven-failsafe-plugin/verify-mojo.html#skipITs\"><$c$c>skipITs,其中仅停止故障安全插件。

There are skip.tests and maven.test.skip and skipTests which stop all tests, and skipITs, which stops only the failsafe plugin.

那么,有没有像 skipITs Maven的命令行标志,而是以onlyITs的功能?

So, is there a command-line flag for maven like skipITs, but instead with the functionality of "onlyITs"?

推荐答案

一个解决方法是调用:

mvn clean test-compile failsafe:integration-test

诚然,这是丑陋的,但它可能会解决你的问题。

Admittedly, this is ugly, but it may solve your problem.

或(另劈):

mvn clean integration-test -Dtest=SomePatternThatDoesntMatchAnything -DfailIfNoTests=false

参考:

这篇关于在行家prevent单元测试,但允许集成测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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