The gradle plugin right now can only run tests against a single build type,
which by default is debug.
You can change that with
android {
testBuildType "coverage"
}
On Wed, Jul 29, 2015 at 2:45 PM, Marek Defecinski <[email protected]>
wrote:
> Hi Guys,
>
> I want to measure code coverage for the project which has 2 buildtypes
> (default)
> release
> debug
>
> When I add testCoverageEnabled and jacoco closue what I get is
> instrumented build
> and I can run
> :app:createDebugCoverageReport
> which generates the report.
>
> but debug builds are currently used by developers to run & test the app so
> I don't want to have jacoco inside those build.
>
> I thought to add another build type to handle coverage.
>
> I added
> coverage {
> initWith buildTypes.debug
> testCoverageEnabled true
> }
>
> What I get is app-coverage.apk app-debug.apk (debug still has
> testCoverageEnabled) and app-release.apk with first 2 having inside jacoco
> and jacoco call (checked with dex2jar and jd-gui).
> However there is no
> :app:createCoverageCoverageReport
>
> and connectedCheck only generates report for debug buildType (does not run
> coverage type).
>
> And when I delete testCoverageEnable true from debug type I don't get
> coverage measured + :app:createDebugCoverageReport is no longer available.
>
> Questions are.
> 1. Is this something wrong in my thinking I want a separate coverage build
> ?
> 2. Do I understand that jacoco is only available in debug builds ?
> 3. I tried to look at source code of jacocoplugin and extension and to me
> it does not seem to be limited to debug
> https://android.googlesource.com/platform/tools/base
> at
> build-system/gradle-core/src/main/groovy/com/android/build/gradle/internal/coverage/
> but I am not sure If I look at correct source code.
>
> Best Regards
>
> --
> You received this message because you are subscribed to the Google Groups
> "adt-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
http://developer.android.com | http://tools.android.com
Please do not send me questions directly. Thanks!
--
You received this message because you are subscribed to the Google Groups
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.