You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Integration test + some other minor improvements. (#1)
* Added a proper integration test to the plugin that tests the plugin on a project with three module types: `android-library`, `android-application` and `java-library`.
* New configuration option: `testTypes`
* Updated README.md
* improved warning and error messages
* Updated version to 1.0.0.
**A Gradle plugin for easy generation of combined code coverage reports for Android projects with multiple modules.**
3
-
Generating code coverage reports for Android Projects that make use of the Gradle build is quite easy. Unfortunately by default code coverage is generated separately per module, this means each modules takes into account it's own sources and tests, which is in terms of domain separation fine. However it is very common to find multi-module Android project where only one module has instrumented tests, or full-fledged UI tests using Espresso. This plugin comes in handy for those projects. It generates code coverage reports using Jacoco taking into account all the modules and tests at once.
2
+
**A Gradle plugin for combined code coverage reports for Android projects.**
3
+
Generating code coverage reports for Android Projects is in most cases quite easy. Unfortunately by
4
+
default (using Jacoco) code coverage is generated separately per module. This means each module
5
+
takes into account it's own sources and tests (which is in terms of domain separation fine). However
6
+
it is very common to find multi-module Android projects where only one module actually has tests.
7
+
This plugin comes in handy for those projects. It generates code coverage reports using Jacoco
8
+
taking into account all the modules and tests at once, or in other words: code in module B will show
9
+
up as "covered" when tests in Module A touch it.
4
10
5
11
- Supports both Android app and library modules (`com.android.application` & `com.android.library`).
6
12
- Supports different build variants per module within the same report.
7
-
- Supports custom filters.
13
+
- Supports custom package/class filters.
14
+
8
15
9
16
# Setup
10
-
Apply the Android-Root-Coverage-Plugin plugin to your top-level (root project) gradle file following these 2 steps:
17
+
Apply the Android-Root-Coverage-Plugin plugin to your top-level (root project) gradle file:
11
18
12
19
```groovy
13
20
// Step 2: Apply the plugin to the top-level gradle file
Currently only modules with the plugin type `com.android.application` or `com.android.library` are taken into account when generating the root code coverage report, besides this any module that does not have `testCoverageEnabled true` for the default build variant (`debug`) will be skipped::
33
+
Currently only modules with the plugin type `com.android.application` or `com.android.library` are
34
+
taken into account when generating the coverage report, besides this any module that does not have
35
+
`testCoverageEnabled true` for the selected build variant (by default: `debug`) will be skipped:
26
36
27
37
You can add a module by enabling `testCoverageEnabled`:
28
38
```groovy
@@ -35,35 +45,55 @@ android {
35
45
}
36
46
```
37
47
38
-
The Android-Root-Coverage-Plugin generates a special Gradle task `:rootCodeCoverageReport` that when executed generates a Jacoco code coverage report. You can either run this task directly from Android Studio using the Gradle Tool Window (see: https://www.jetbrains.com/help/idea/jetgradle-tool-window.html) or from the terminal.
48
+
The Android-Root-Coverage-Plugin generates a special Gradle task `:rootCodeCoverageReport` that when
49
+
executed generates a Jacoco code coverage report. You can either run this task directly from
50
+
Android Studio using the Gradle Tool Window (see:
51
+
https://www.jetbrains.com/help/idea/jetgradle-tool-window.html) or from the terminal.
39
52
40
53
-**Gradle Tool Window:** You can find the task under: `Tasks > reporting > rootCodeCoverageReport`, double click to execute it.
41
54
-**Terminal:** Execute the task using `gradlew rootCodeCoverageReport`.
42
55
56
+
43
57
# Configuration
44
-
By default the plugin generates code coverage reports using the build variant `debug` for every module. However in some cases different build variants per module might be required, especially if there is no `debug` build variant available. In those cases you can configure custom build variants for specific modules:
58
+
By default the plugin generates code coverage reports using the build variant `debug` for every
59
+
module. However in some cases different build variants per module might be required, especially if
60
+
there is no `debug` build variant available. In those cases you can configure custom build variants
61
+
for specific modules:
45
62
46
63
```groovy
47
64
rootCoverage {
48
65
// The default build variant for every module
49
66
buildVariant "debug"
50
67
// Overrides the default build variant for specific modules.
0 commit comments