Skip to content

Instantly share code, notes, and snippets.

Avatar

Ahmed basyouni ahmed-basyouni

View GitHub Profile
@ahmed-basyouni
ahmed-basyouni / JacocoTestReport
Last active Jan 3, 2018
A gradle task that can ignore certain packages from test coverage such as models
View JacocoTestReport
// packages to exclude for example generated classes, R class and models package, add all packages that you wish to exclude from test coverage
def fileFilter = [
'**/models/**',
'**/*$ViewInjector*.*','**/*$ViewBinder*.*',
'**/R.class', '**/R$*.class', '**/BuildConfig.*',
'**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
def debugTree = fileTree(dir: "${buildDir}/intermediates/classes/debug", excludes: fileFilter)
def mainSrc = "${project.projectDir}/src/main/java"
// override jacocTestReport task