【发布时间】:2015-07-23 04:57:19
【问题描述】:
我有一个包含 junit 测试和 testng 测试的测试。当我从父 pom 运行“mvn test”时它工作正常,但是在 jenkins 中构建时 testng 测试失败。我需要一种方法来跳过在 jenkins 中运行的 testng 测试。
【问题讨论】:
-
检查您的测试在 Jenkins 中失败的原因。
标签: maven jenkins junit testng
我有一个包含 junit 测试和 testng 测试的测试。当我从父 pom 运行“mvn test”时它工作正常,但是在 jenkins 中构建时 testng 测试失败。我需要一种方法来跳过在 jenkins 中运行的 testng 测试。
【问题讨论】:
标签: maven jenkins junit testng
你说你使用 jenkins,所以我假设你使用的是 maven 插件:
您是否尝试在 Maven 运行中跳过测试用例?在 maven 插件的 maven 属性部分使用以下代码:
maven.test.failure.ignore=true
或者
请在 maven 插件的属性部分使用下面的代码来跳过测试用例
skipTests=true
希望对你有帮助
【讨论】:
最好在 Jenkins 的作业配置中通过 runtime 设置:
调用顶级 Maven -> 高级。 添加 maven.test.skip=true
一旦测试正常,只需删除此行。
您也可以在运行时禁用测试执行: mvn -Dmaven.test.skip=true
【讨论】: