android - Gradle - Jacoco code coverage without running connectedCheck -
i'm using android studio 1.2.2 , gradle plugin 1.2.3.
i'm trying generate code coverage report without running gradlew connectedcheck
, gradlew test
. want avoid need have connected device or emulator, can speed builds on jenkins server.
the best i've been able far include unit tests execution data in report, described here: jacoco code coverage in android studio. useful displaying results tests, @ moment want run unit tests (junit4 , robolectric).
is there way edit createdebugcoveragereport
gradle task doesn't run connectedandroidtest
?
thank you.
i managed find workaround. namely, disabling connectedandroidtest
task.
project.afterevaluate { def append = "append=true" def destfile = "destfile=$builddir/outputs/code-coverage/connected/coverage.ec" testdebug.jvmargs "-javaagent:$builddir/intermediates/jacoco/jacocoagent.jar=$append,$destfile" createdebugcoveragereport.dependson testdebug connectedandroidtestdebug.enabled = false }
so, starting solution proposed in answer, adds unit test coverage instrumentation test coverage, i've disabled instrumentation test task. allows me run unit tests, without needing connected device, executing createdebugcoveragereport
task.
Comments
Post a Comment