testng how to set configfailurepolicy=true

2019-09-11 02:20发布

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

2条回答
何必那么认真
2楼-- · 2019-09-11 02:30

If that's a system property then set it in the test:

test {
     systemProperty 'configurefailuserpolicy', 'true'
}
查看更多
萌系小妹纸
3楼-- · 2019-09-11 02:48

You can define it in your test task:

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

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.html https://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'
}
查看更多
登录 后发表回答