Skip to content

Instantly share code, notes, and snippets.

@Manikkumar1988
Last active May 9, 2019 00:05
Show Gist options
  • Save Manikkumar1988/9840775c2fdc7054276a7c686ef9209e to your computer and use it in GitHub Desktop.
Save Manikkumar1988/9840775c2fdc7054276a7c686ef9209e to your computer and use it in GitHub Desktop.
Fuellogger Android App
apply plugin: 'com.android.application'
apply plugin: 'jacoco'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.mani.fuellog"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
testCoverageEnabled true
}
}
testOptions {
unitTests {
includeAndroidResources = true
returnDefaultValues = true
}
}
sourceSets {
androidTest {
java.srcDirs += "src/sharedTest/java"
}
test {
java.srcDirs += "src/sharedTest/java"
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.vectordrawable:vectordrawable:1.0.1'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
// Robolectric
testImplementation "org.robolectric:robolectric:$robolectric_version"
// Android test runner and rules
androidTestImplementation "androidx.test:runner:$test_runner_version" // 1.1.0
androidTestImplementation "androidx.test:core:$test_core_version" // 1.1.0
androidTestImplementation "androidx.test.ext:junit:$test_junit_version" // 1.1.0
androidTestImplementation "androidx.test:rules:$test_rules_version" // 1.1.0
androidTestImplementation "org.mockito:mockito-android:2.15.0"
testImplementation "androidx.test:runner:$test_runner_version" // 1.1.0
testImplementation "androidx.test:core:$test_core_version" // 1.1.0
testImplementation "androidx.test.ext:junit:$test_junit_version" // 1.1.0
testImplementation "androidx.test:rules:$test_rules_version" // 1.1.0
testImplementation 'org.mockito:mockito-core:2.15.0'
// Espresso
androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_core_version" //3.1.0
androidTestImplementation "androidx.test.espresso:espresso-intents:$espresso_intents_version" //3.1.0
testImplementation "androidx.test.espresso:espresso-core:$espresso_core_version" //3.1.0
testImplementation "androidx.test.espresso:espresso-intents:$espresso_intents_version" //3.1.0
debugImplementation 'androidx.fragment:fragment-testing:1.1.0-alpha07' //Imports FragmentScenario into the project
}
jacoco {
toolVersion = "0.8.3"
reportsDir = file("$buildDir/customJacocoReportDir")
}
tasks.withType(Test) { jacoco.includeNoLocationClasses = true }
task jacocoTestReport(type: JacocoReport) {
reports {
xml.enabled = true
html.enabled = true
}
def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
def debugTree = fileTree(dir: "${buildDir}/intermediates/javac/debug/compileDebugJavaWithJavac/classes", excludes: fileFilter)
def mainSrc = "src/main/java"
sourceDirectories = files([mainSrc])
classDirectories = files([debugTree])
executionData = fileTree(dir: "$buildDir", includes: [
"jacoco/testDebugUnitTest.exec",
"outputs/code-coverage/connected/*coverage.ec"
])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment