Playground Android project to test jacoco-report github action

Overview

jacoco-android-playground

Playground Android project to test jacoco-report github action

Running Code Coverage at Module level

  • The app module has multiple product flavors, and so it has 8 variants of coverage. To run code coverage for "prod" flavor with env dimension and "normal" flavor with api dimension for "debug" build type, run ./gradlew prodNormalDebugCoverage
  • The math and text modules has only buildTypes, and so to get the coverage, run ./gradlew debugCoverage.
  • You could run the ./gradlew coverAllVariants to generate code coverage reports for all variants supported in the app.

Running Code Coverage for entire project

  • Choose the variants for each module that you want to run code coverage.
  • Add them to the variants array in project.gradle.
  • Either run the individual Coverage task for each variant, or just run ./gradlew coverAllVariants.
  • Run ./gradlew allDebugCoverage.
  • The unified report will be generated under ${rootDir}/build/reports/jacoco/

For the full article on this read this blog.

You might also like...
Demo Android application using Gradle. Project is written entirely in Kotlin with MVVM architecture
Demo Android application using Gradle. Project is written entirely in Kotlin with MVVM architecture

Demo Android application using Gradle. Project is written entirely in Kotlin with MVVM architecture, Dagger / Hilt Dependency Injection, Room Database and Retrofit API Calls

πŸ‘¨β€πŸ’» A demonstration modern Android development project with Jetpack(Compose, Room, ViewModel, Navigation), Hilt and based on MVVM by using Open Sky API. ✈️ 🌍
πŸ‘¨β€πŸ’» A demonstration modern Android development project with Jetpack(Compose, Room, ViewModel, Navigation), Hilt and based on MVVM by using Open Sky API. ✈️ 🌍

A demonstration modern Android development project with Jetpack(Compose, Room, ViewModel, Navigation), Hilt and based on MVVM by using Open Sky API.

Eutamin-C Sample Project
Eutamin-C Sample Project

here-is-my-card About Eutamin-C Sample Project This is an android application using Euphony library "here-is-my-card" makes it easy to share business

A sample project managing the dependencies using Gradle version catalog

playground-gradle-bom-dep-manage A sample project managing the dependencies using Gradle version catalog. Pros/Cons Comparison with dependency managem

Project with AIDL, LifecycleService, CustomView
Project with AIDL, LifecycleService, CustomView

Digital Speedometer Project, where speed values are generated in background in the Service (SpeedValuesService). Then values are sent to Activity (Mai

A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar
A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar

#Android-LollipopShowcase This is a simple showcase to show off Android's all new Material Design and some other cool new stuff which is (new) in Andr

A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar
A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar

#Android-LollipopShowcase This is a simple showcase to show off Android's all new Material Design and some other cool new stuff which is (new) in Andr

simple android grocery app using kotlin and android studio
simple android grocery app using kotlin and android studio

Project Idea The idea of this project is to make a grocery android app that users can use to order the groceries they want. It doesn't contain any bac

Beetlebug is an open source insecure Android application with CTF challenges built for Android Penetration Testers and Bug Bounty hunters.
Beetlebug is an open source insecure Android application with CTF challenges built for Android Penetration Testers and Bug Bounty hunters.

Beetlebug Beetlebug is a beginner-friendly Capture the Flag Android application that aims to inspire interest in Mobile Application Security. It is ge

Comments
  • How to ignore a specific module from coverage?

    How to ignore a specific module from coverage?

    I would like to ignore a specific module from final coverage (allDebugCoverage task).

    Although we can comment out this line in build.gradle of that module, like this

    plugins {
        id 'com.android.application'
        id 'kotlin-android'
    }
    // apply from: '../jacoco/modules.gradle'
    

    But if we put apply from: '../jacoco/modules.gradle' to the base configuration Gradle file, then it's not so easy.

    Do you know if is there any way to ignore the module in /jacoco/project.gradle instead? I see there is a sample here, but it's applied to subprojects closure.

    question 
    opened by anticafe 3
  • Print coverage result after finish `allDebugCoverage` task

    Print coverage result after finish `allDebugCoverage` task

    I notice in https://github.com/alisonthemonster/Presently/blob/develop/gradle/jacoco_ci.gradle , there is a quite interesting task printReport which will print coverage result. For example:

    - instruction coverage rate is 28.23%
    - line coverage rate is 25.36%
    - method coverage rate is 39.28%
    - class coverage rate is 35.46%
    

    Would you mind to integrate it to your Jacoco script too?

    opened by anticafe 1
  • app module code coverage does not show

    app module code coverage does not show

    First of all thanks for creating this awesome repository. I have integrated Sonarqube with this repository. Unfortunately I can’t see app module code coverage there.

    Then I tried to delete productFlavors and re-ran and fortunately Sonarqube shows test code coverage for app module.

    Deleted from build.gradle.

    productFlavors {
            prod {
                dimension "env"
            }
            staging {
                dimension "env"
            }
            normal {
                dimension "api"
            }
            legacy {
                dimension "api"
            }
        }
    

    Can you please help me out here ?

    opened by hpatel123 0
Owner
Saravana
Crazy Android developer and a clean code evangelist.
Saravana
This is a repository for implementing Brontodroid and test it easily before we finalize things into a library/module to be consumed separately.

Bronto Playground This is a repository for implementing Brontodroid and test it easily before we finalize things into a library/module to be consumed

Ishat Gupta 1 Nov 30, 2021
This repo demonstrates how to work on CI/CD for Mobile Apps πŸ“± using Github Actions πŸ’Š + Firebase Distribution πŸŽ‰

Android-CICD This repo demonstrates how to work on CI/CD for Mobile Apps ?? using Github Actions ?? + Firebase Distribution ?? Getting Started We are

Mohamed Elsharkawy 50 Nov 29, 2022
Minimal example of how to safely share a file produced by a task in one project, with a task in another project.

How to share files across Gradle subprojects: A minimal example This is the Gradle project: . β”œβ”€β”€ producer β”‚ └── build.gradle.kts β”œβ”€β”€ consumer β”‚ β””

Rob Moore 2 Dec 17, 2021
Quality-Tools-for-Android 7.5 0.0 L5 Java This is an Android sample app + tests that will be used to work on various project to increase the quality of the Android platform.

Quality Tools for Android This is an Android sample app + tests that will be used to work on various project to increase the quality of the Android pl

StΓ©phane Nicolas 1.3k Dec 27, 2022
Sample Project for Android Support Library 23.2

SnapShot: Contains features Vector Drawable Animated Vector Drawable AppCompat DayNight theme Bottom Sheets Using BottomSheetDialog in day-night mode.

Huqiu Liao 779 Nov 24, 2022
A project which demonstrate how to develop a custom client on android for dribbble.com

##What is this? This is a project with custom client app on android for https://dribbble.com, which you can browse the popular icon and animation, lik

ZhangLei 599 Nov 14, 2022
This project is focused on the sample using the API's new preview version of Android-L, use of transitions, shadows etc...

Android L preview example Description This project is focused on the sample using the API's new preview version of Android-L, use of transitions, shad

Saul Molinero 165 Nov 10, 2022
The example Android project of animated menu items in toolbar

Android Animated Menu Items The example Android project of animated menu items in toolbar. Thanks Srikant Shetty for idea of this animation. Cut: Copy

Ilya Fomenko 922 Nov 23, 2022
This project is focused on the sample using the API's new preview version of Android-L, use of transitions, shadows etc...

Android L preview example Description This project is focused on the sample using the API's new preview version of Android-L, use of transitions, shad

Saul Molinero 165 Nov 10, 2022