Skip to content

AmitKaushikGIT/android-coverage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

android-coverage

Plugin creates customizable tasks which generate coverage reports for unit and instrumentation tests.

Also helps you set coverage threshold for you source code and creates tasks to verify your code coverage meets the threshold.

#Latest Version 1.0 - experimental

#Adding gradle dependency

buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }

    dependencies {
        classpath 'in.proroaster.kaushik:coverage:1.0'
    }
}

#Tasks Creates following tasks for debug build type:

  1. flavorDebugUnitTestCoverage
  2. flavorDebugInstrumentationTestCoverage
  3. mergeFlavorDebugCoverageReports
  4. checkFlavorDebugUnitTestCoverage
  5. checkFlavorDebugAndroidTestCoverage

#extensions Offers extentions to configure your reports:

coverage{

    unitTestConfig {
        exclusions []
        inclusions []
        executionData ""
        csvReport false
        boolean checkThresholdAfterRunningTest = true
        def coverageLimits = [:]
    }

    instrumentationTestConfig {
        exclusions []
        inclusions []
        executionData ""
        csvReport false
        checkThresholdAfterRunningTest = true
        coverageLimits = [:]
    }

}

#CoverageLimits specify coverage thresholds in form of map, where keys are type of coverage

Valid keys are -{
    'instruction'
    'branch'     
    'line'       
    'complexity' 
    'method'     
    'class'      
}

#checkThresholdAfterRunningTest

set true if you want to run coverage threshold check whenever you run test(Ideal way)

if you want to run your check separately, remember to generate coverage report before running check

i.e. if you set to true then you can run checkFlavorDebugUnitTestCoverage which will run flavorDebugUnitTestCoverage as dependency

#Notes

  • can be applied to android applications and library
  • jacoco must be applied for coverage

About

Android test coverage plugin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published