'continue jacoco code coverage report after fail test case

Code coverage report not generated when Test case failed in android studio using Jacoco plugin.How to skip failed test case and generate code coverage report.



Solution 1:[1]

Try adding this flag when running your test

-Djacoco.haltonfailure=false

Solution 2:[2]

Use the following code in Build.gradle(Module:app):

android {

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

buildTypes {
    debug {
        testCoverageEnabled true
        }
    }
}   

Solution 3:[3]

If you just need to get the report you can add the @Ignore above the tests in order to temporarily skip them. When you take care of the reason these tests fail then you just remove the annotation.

This annotation will not run any of the marked tests, you can use it either at class file or at the method/test.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 osrs10
Solution 2 Rob
Solution 3