简体   繁体   中英

How can I ignore test failures with the gradle robolectric plugin?

I'm using the robolectric-gradle-plugin for robolectric unit tests. I don't want to fail a build on failed tests. Is there a way in DSL or a property not to fail a test on the build similar to -DtestFailureIgnore=true on the Surefire Maven plugin?

I've tried:

robolectric {
    ignoreFailures = true
}

and

robolectric {
    ignoreFailure = true
}

and -DignoreFailure=true on the command line.

I can't seem to find any documentation of how to do this, or any reference to ignoring tests in the source code.

answering very old question, so that it might help others who bump into here

testOptions {
    unitTests.all {
        setIgnoreFailures(true)
    }
}

I would suggest not to continue building an APK if there are any failing tests. But if you want to build an APK without testing the only way right now is to use gradle build -x test[1]. This will run build and not run any tests.

[1] http://www.gradle.org/docs/current/userguide/userguide_single.html#sec:excluding_tasks_from_the_command_line

try without '='

robolectric {
    ignoreFailures true
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM