Skip to content

Commit

Permalink
- add test coverage to the project.
Browse files Browse the repository at this point in the history
  • Loading branch information
huxaiphaer committed Aug 5, 2019
1 parent e1c49f7 commit 5d63aa8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ script:
# - ./gradlew :owncloudApp:installDebugAndroidTest
# run sample instrumented unit test
# - adb shell am instrument -w -e debug false -e class com.owncloud.android.datamodel.OCFileUnitTest com.owncloud.android.test/android.support.test.runner.AndroidJUnitRunner
# run the jacoco test report on Travis
- if [ -e ./gradlew ]; then ./gradlew jacocoTestReport;else gradle jacocoTestReport;fi
# upload the test coverage to Travis.
- bash <(curl -s https://codecov.io/bash)
env:
global:
- secure: h4Y7ZvgbvOj5T71ubRcw3Fy3KXF8qHugRFLGK3q2R9YuRsDAf8XH+Y/UiXyH8sac2QSj7Zlny1kA1DEJgwhTXs9wsAVKVJCQNTJGEvhm/4uQgPeNMzMv07Lqe8V+KUBsFH5qhfPJO357ERW0k2f2qljoLSHtHStclt7iGvFdynA=
Expand Down
27 changes: 27 additions & 0 deletions owncloudApp/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'jacoco'

jacoco {
toolVersion = "0.7.6.201602180812"
}

tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
}


task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) {

reports {
xml.enabled = true
html.enabled = true
}

def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
def debugTree = fileTree(dir: "$project.buildDir/intermediates/classes/debug", excludes: fileFilter)
def mainSrc = "$project.projectDir/src/main/java"

sourceDirectories = files([mainSrc])
classDirectories = files([debugTree])

}

def commitSHA1 = 'COMMIT_SHA1'
def gitRemote = 'GIT_REMOTE'
Expand Down Expand Up @@ -121,6 +147,7 @@ android {

debug {
applicationIdSuffix ".debug"
testCoverageEnabled true
}
}

Expand Down

0 comments on commit 5d63aa8

Please sign in to comment.