How to generate code coverage report for Instrumentation test cases in Android Studio

A report is currently running on code coverage of functional Unit Test cases.

  • Updated to the latest version of Android Studio (1.2.1)
  • Updated Android plugin in Android Studio (1.2.3)
  • Updated Gradle Version (2.2.1)
  • Unit Test Build Option Changed

Now I can get the Code Coverage report (using the default IntelliJ Idea Code coverage tool) of the unit tests that I wrote, extending the TestCase class. But when I write a class extending AndroidInstrumentatioTestCase2 or ActivityTestCase , I get t null when calling getActivity() . And when I switch the build options to the tools, the Run button with code is disabled.

So, in simple words, I want to know how to get a Code Coverage report in test cases that are both functional Unit Test cases and Instrumentation test cases.


PS: You can also use any other plugin to cover the code (for example, JaCoCo).

+7
android android-studio unit-testing code-coverage
source share

No one has answered this question yet.

See related questions:

753
Code formatting shortcut in Android Studio
435
What is reasonable% coverage for unit tests (and why)?
63
How to get code coverage using Android Studio?
fifteen
Jacoco code coverage in Android Studio with flavors
7
Code coverage in android studio 1.2 for instrumental tests
3
Generate code coverage report using Android Studio 1.0
2
Running with Code Coverage does not appear in Android Studio 1.5.1 for the base project of empty activity for control and measurement tests
2
Jacoco announces 0 coverage of Kotlin classes with unit tests in Android project
one
Test coverage with Jacoco plugin for Gradle offline for Android
0
trying to get code coverage with jacoco in android unit testing studio

All Articles