Skip to content

Commit 5d63aa8

Browse files
author
huxaiphaer
committed
- add test coverage to the project.
1 parent e1c49f7 commit 5d63aa8

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ script:
3333
# - ./gradlew :owncloudApp:installDebugAndroidTest
3434
# run sample instrumented unit test
3535
# - adb shell am instrument -w -e debug false -e class com.owncloud.android.datamodel.OCFileUnitTest com.owncloud.android.test/android.support.test.runner.AndroidJUnitRunner
36+
# run the jacoco test report on Travis
37+
- if [ -e ./gradlew ]; then ./gradlew jacocoTestReport;else gradle jacocoTestReport;fi
38+
# upload the test coverage to Travis.
39+
- bash <(curl -s https://codecov.io/bash)
3640
env:
3741
global:
3842
- secure: h4Y7ZvgbvOj5T71ubRcw3Fy3KXF8qHugRFLGK3q2R9YuRsDAf8XH+Y/UiXyH8sac2QSj7Zlny1kA1DEJgwhTXs9wsAVKVJCQNTJGEvhm/4uQgPeNMzMv07Lqe8V+KUBsFH5qhfPJO357ERW0k2f2qljoLSHtHStclt7iGvFdynA=

owncloudApp/build.gradle

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
apply plugin: 'com.android.application'
22
apply plugin: 'kotlin-android'
3+
apply plugin: 'jacoco'
4+
5+
jacoco {
6+
toolVersion = "0.7.6.201602180812"
7+
}
8+
9+
tasks.withType(Test) {
10+
jacoco.includeNoLocationClasses = true
11+
}
12+
13+
14+
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) {
15+
16+
reports {
17+
xml.enabled = true
18+
html.enabled = true
19+
}
20+
21+
def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
22+
def debugTree = fileTree(dir: "$project.buildDir/intermediates/classes/debug", excludes: fileFilter)
23+
def mainSrc = "$project.projectDir/src/main/java"
24+
25+
sourceDirectories = files([mainSrc])
26+
classDirectories = files([debugTree])
27+
28+
}
329

430
def commitSHA1 = 'COMMIT_SHA1'
531
def gitRemote = 'GIT_REMOTE'
@@ -121,6 +147,7 @@ android {
121147

122148
debug {
123149
applicationIdSuffix ".debug"
150+
testCoverageEnabled true
124151
}
125152
}
126153

0 commit comments

Comments
 (0)