Questions tagged [android-jacoco]

22 questions
8
votes
1 answer

Setting up jacoco for multi-module Android codebase with Gadle kotlin

I am currently setting up Jacoco in an Android codebase that my team built. I don't have much experience in Android but I have set up Jacoco before in a Spring Boot codebase so that I can track the test coverage in Sonarqube. But I am having hard…
Petra Barus
  • 3,815
  • 8
  • 48
  • 87
4
votes
0 answers

Updating to Gradle 8 in Android: implicit dependency error between variants

I have an Android app with 4 variants, and I have a Bitrise instance that runs this command: ./gradlew "testDevADebugUnitTestCoverage" "testDevBDebugUnitTest" "testDevCDebugUnitTest" "testDevCDebugUnitTest" "--continue" "-PjacocoEnabled=true" in the…
noloman
  • 11,411
  • 20
  • 82
  • 129
3
votes
0 answers

JaCoCo 0.8.7 has issues compiling with Android API level 32

In my Android Studio project I used this example with its including gradle scripts to run on each of my modules and combine all results of all modules together into one single coverage report. See GitHub playground project which worked fine so far…
Ralf Wickum
  • 2,850
  • 9
  • 55
  • 103
3
votes
0 answers

Classes in bundle 'app' do not match with execution data - Android

Although similar questions are already present on internet, but I am unable to find any solution to this problem with regards to android platform. My project has multiple product flavors, uses kotlin and hilt. I believe byte code transformation…
NightFury
  • 13,436
  • 6
  • 71
  • 120
3
votes
0 answers

Android + JaCoCo: jacocoTestCoverageVerification never fails

I am trying to configure a new Android project to use JaCoCo for test coverage and fail when coverage is below a certain threshold. I have used this documentation, as well as looking at many SO posts. I expect the task to fail, since I don't have…
3
votes
0 answers

Why is the JaCoCo .exec file generated for Android off-device tests almost empty if testCoverageEnabled is true, but only for library modules?

I'm working in a multi-module Android project with an application module and a library module. If I simply add apply plugin: 'jacoco' jacoco { toolVersion '0.8.7' } to the build.gradle for each module, then when I run the off-device unit tests…
Aidan64
  • 573
  • 1
  • 5
  • 12
2
votes
0 answers

Android code coverage with Fastlane, Jacoco doesn't support Fastlane

I am struggling to get code coverage percentage from Fastlane android, I used JACOCO but it doesn't support fastlane. Xcov for code coverage is also not having support for Android. Can anyone suggest any Fastlane plugin or any solution to get code…
2
votes
0 answers

Gradle task :app:createDebugAndroidTestCoverageReport fails, why?

When I run gradlew createDebugCoverageReport it fails with: Task :app:connectedDebugAndroidTest Starting 1 tests on Tablet_Sv2(AVD) - 12 Test results saved as…
Ralf Wickum
  • 2,850
  • 9
  • 55
  • 103
1
vote
0 answers

How to configure JaCoCo (to exclude some source files) for Android project with isTestCoverageEnabled=true

The code coverage works perfectly fine for me when just set isTestCoverageEnabled = true in my BuildType Android Gradle configuration. It creates 2 tasks createReleaseUnitTestCoverageReport for release build type and…
Adjorno
  • 51
  • 4
1
vote
0 answers

How to cover lambda function in coverage kotlin

I am using jococo for test coverage. I want to cover every package, but I added this code @Retention(AnnotationRetention.BINARY) annotation class NoCoverageGenerated to not excluded that class which I don't want to cover. But there is problem…
Kotlin Learner
  • 3,995
  • 6
  • 47
  • 127
1
vote
0 answers

update to Android studio (fox) 2020.3.1 patch3 unit test/coverage test not working

Having an android library project working fine with AS 4.1.2. Just installed Android studio (fox) 2020.3.1 patch 3 without change anything (except set the sdk jre to java 8, version 18.6.0_60, since the project is using…
0
votes
1 answer

How to exclude some pakages from code coverage report using android and jacoco

I try to exclude some packages from the jacoco report but I don't find any documentation about doing that. I tried that, but doesn't work: testOptions { unitTests { jacoco { afterEvaluate { …
B3n
  • 536
  • 1
  • 3
  • 16
0
votes
0 answers

How can i get covered lines from jacoco programmatically

I try to write my own analyzer for .exec files from jacoco. I have some examples, but in android studio coverage.coveredLines and coverage.getFullClassName do nott work. How can I get coveredLines from .exec files? This is my code: class…
0
votes
0 answers

jacoco agent is started with excludes=* by gradle only on some modules

I work on Android project with multiple submodules. I'm trying to generate coverage report using jacoco but for some modules test coverage appears to be empty. I tracked down the execution to gradle test tasks and noticed that for missing modules…
poldek
  • 137
  • 2
  • 8
0
votes
0 answers

Jacoco Offline instrumentation Android Script

I am trying to use Jacoco Offline instrumentation in my android project to get coverage with PowerMockito. Following is my build.gradle. apply plugin: 'jacoco' configurations { jacocoAnt jacocoRuntime } jacoco { toolVersion =…
Dharsam1990
  • 121
  • 10
1
2