本文介绍了testng如何设置configfailurepolicy = true的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为testng设置'configfailurepolicy = continue'我使用gradle来运行测试。

i已尝试
gradle clean test -Dgroups = abc -Dconfigurefailurepolicy =继续
没有工作我不希望测试用例在beforeClass方法失败后失败。

How to set 'configfailurepolicy=continue' for testng i'm using gradle to run the tests.
i tried gradle clean test -Dgroups=abc -Dconfigurefailurepolicy=continuewhich didn't work I don't want the test cases to be failing after beforeClass method fails.

推荐答案

您可以在 test 任务中定义它:

You can define it in your test task:

test {
    useTestNG() {
        configFailurePolicy 'continue'
        includeGroups 'myTestGroup'
        ...
    }
}

但此属性仅适用于Gradle版本2.3+

but this property is available only in Gradle version 2.3+ http://gradle.org/docs/2.3/groovydoc/org/gradle/api/tasks/testing/testng/TestNGOptions.htmlhttps://issues.gradle.org/browse/GRADLE-3149

如果你没有最新的你可以用任务生成包装:

If you don't have newest version you can generate wrapper with task:

task wrapper(type: Wrapper) {
    gradleVersion = '2.3'
}

这篇关于testng如何设置configfailurepolicy = true的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 08:03