Skip to content Skip to sidebar Skip to footer

Don't Fail The Gradle Build If A Test Is Failing With The Gradle-android-test-plugin

I set my project up to run with Robolectric and the the gradle-android-test-plugin. This all works fine and first tests are running and failing. If a test fails this will also fai

Solution 1:

Hmm. Well you have two options I think. One is to use

testTask.ignoreFailures = true

to not let the task fail when a test fails.

Another approach would be to run your gradle command with '--continue'. This will execute as many tasks as possible and list the failed tasks at the end and not stop after the first task has failed.

Solution 2:

The correct syntax with AndroidConnectedTests is as following:

project.gradle.taskGraph.whenReady {
    connectedAndroidTest {
        ignoreFailures = true
    }
}

Now the test task is not failing the build anymore and you can pick up the failed tests with your build server to markt the build as unstable etc.

Post a Comment for "Don't Fail The Gradle Build If A Test Is Failing With The Gradle-android-test-plugin"