Skip to content
This repository was archived by the owner on Oct 9, 2020. It is now read-only.

Commit 6999bfd

Browse files
fix the testing setup
Signed-off-by: Arnav Gupta <[email protected]>
1 parent 8a3b58c commit 6999bfd

File tree

3 files changed

+10
-40
lines changed

3 files changed

+10
-40
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ android:
3333
# - android-wait-for-emulator
3434
# - adb shell input keyevent 82 &
3535
script:
36-
- ./gradlew build jacocoTestReport assembleAndroidTest
36+
- ./gradlew build test
3737
- chmod a+x codestyle.sh
3838
- "./codestyle.sh"
3939
notifications:

app/build.gradle

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
apply plugin: 'com.android.application'
2-
apply plugin: 'jacoco'
3-
// apply from: "https://raw.githubusercontent.com/monstar-lab/gradle-android-ci-check/1.2.0/ci.gradle"
2+
apply plugin: 'jacoco-everywhere'
43

54
def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()
65
def buildTime = new Date().format("yyyy-MM-dd'T'HH:mm'Z'", TimeZone.getTimeZone("UTC"))
@@ -18,6 +17,10 @@ android {
1817
preDexLibraries = preDexEnabled && !isTravis
1918
}
2019

20+
testOptions {
21+
unitTests.returnDefaultValues = true
22+
}
23+
2124
defaultConfig {
2225
applicationId "org.fossasia.openevent"
2326
minSdkVersion 15
@@ -80,9 +83,11 @@ dependencies {
8083
fdroidCompile 'org.apache.directory.studio:org.slf4j.api:1.7.2'
8184
fdroidCompile 'org.slf4j:slf4j-simple:1.7.14'
8285

83-
// Testing
86+
// Unit Test
8487
testCompile 'junit:junit:4.12'
8588
testCompile "org.robolectric:robolectric:3.0"
89+
90+
//Instrumentation Test
8691
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'
8792
androidTestCompile('com.android.support.test:runner:0.4') {
8893
exclude group: 'com.android.support', module: 'support-annotations'
@@ -103,38 +108,3 @@ dependencies {
103108
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1' // or 1.4-beta1
104109
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1' // or 1.4-beta1
105110
}
106-
107-
jacoco {
108-
toolVersion "0.7.1.201405082137"
109-
}
110-
111-
def coverageSourceDirs = [
112-
'src/main/java',
113-
]
114-
115-
task jacocoTestReport(type: JacocoReport) {
116-
group = "Reporting"
117-
description = "Generate Jacoco coverage reports after running tests."
118-
reports {
119-
xml.enabled = true
120-
html.enabled = true
121-
}
122-
classDirectories = fileTree(
123-
dir: './build/intermediates/classes/debug',
124-
excludes: ['**/R*.class',
125-
'**/*$InjectAdapter.class',
126-
'**/*$ModuleAdapter.class',
127-
'**/*$ViewInjector*.class'
128-
])
129-
sourceDirectories = files(coverageSourceDirs)
130-
executionData = files("$buildDir/jacoco/testDebug.exec")
131-
// Bit hacky but fixes https://code.google.com/p/android/issues/detail?id=69174.
132-
// We iterate through the compiled .class tree and rename $$ to $.
133-
doFirst {
134-
new File("$buildDir/intermediates/classes/").eachFileRecurse { file ->
135-
if (file.name.contains('$$')) {
136-
file.renameTo(file.path.replace('$$', '$'))
137-
}
138-
}
139-
}
140-
}

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
}
77
dependencies {
88
classpath 'com.android.tools.build:gradle:2.0.0'
9-
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.1'
9+
classpath 'com.trickyandroid:jacoco-everywhere:0.2.1'
1010
// NOTE: Do not place your application dependencies here; they belong
1111
// in the individual module build.gradle files
1212
}

0 commit comments

Comments
 (0)