Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 832
C. Ross Avatar asked Jul 07 '14 15:07

C. Ross


Video Answer


2 Answers

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

testOptions {
    unitTests.all {
        setIgnoreFailures(true)
    }
}
like image 173
Surge Avatar answered Sep 25 '22 17:09

Surge


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

like image 36
Hiemanshu Sharma Avatar answered Sep 23 '22 17:09

Hiemanshu Sharma