diff --git a/README.md b/README.md index 023e99e..988ae31 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ #Dagger 2 and Realm unit test [![Build Status](https://travis-ci.org/niqdev/dagger-realm-test.svg?branch=master)](https://travis-ci.org/niqdev/dagger-realm-test) +[![Coverage Status](https://coveralls.io/repos/github/niqdev/dagger-realm-test/badge.svg?branch=master)](https://coveralls.io/github/niqdev/dagger-realm-test?branch=master) -:tada: Updated with Realm v1.x!! +:tada: Updated with Realm v1.x!! [Robolectric/Realm issue](https://github.com/robolectric/robolectric/issues/1389) -Sample Android application of Dagger 2 and Realm tested with Robolectric, Mockito and PowerMockito. +Sample Android application of [Dagger 2](http://google.github.io/dagger/) and [Realm](https://realm.io/docs/java/latest/) tested with [Robolectric](http://robolectric.org/), [Mockito](http://mockito.org/) and [PowerMockito](https://github.com/jayway/powermock). Example ```java diff --git a/app/build.gradle b/app/build.gradle index 6ad2b69..788daa3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,6 +1,7 @@ apply plugin: 'com.android.application' apply plugin: 'android-apt' apply plugin: 'realm-android' +apply from: '../coverage.gradle' android { compileSdkVersion 24 diff --git a/build.gradle b/build.gradle index b2c8437..09a0a1d 100644 --- a/build.gradle +++ b/build.gradle @@ -6,6 +6,8 @@ buildscript { classpath 'com.android.tools.build:gradle:2.1.2' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' classpath 'io.realm:realm-gradle-plugin:1.1.0' + classpath 'com.vanniktech:gradle-android-junit-jacoco-plugin:0.5.0' + classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.6.3' } } diff --git a/coverage.gradle b/coverage.gradle new file mode 100644 index 0000000..d29bc93 --- /dev/null +++ b/coverage.gradle @@ -0,0 +1,17 @@ +// ./gradlew jacocoTestReportDebug + +apply plugin: 'com.vanniktech.android.junit.jacoco' +apply plugin: 'com.github.kt3k.coveralls' + +junitJacoco { + jacocoVersion = '0.7.7.201606060606' +} + +coveralls { + jacocoReportPath = "${buildDir}/reports/jacoco/debug/jacoco.xml" +} + +tasks.coveralls { + dependsOn 'connectedAndroidTest' + onlyIf { System.env.'CI' } +} \ No newline at end of file