With the new version of Android Studio 1.2, you can run your unit tests and view coverage in the IDE.
First, you will need to run your unit tests in the IDE. (if you can already, skip this step)
This guide and demo will help you.
Secondly, you need to create a JUnit Run configuration

Inside this configuration you can choose
- Type of test: "Everything in the package"
- Package: [package where your tests are located, for example: "com.myapp.tests"]
- Search for tests: Interdependence between modules (may be the difference for your settings)
- VM -options: -ea
- Working directory: [directory of your project]
- Use mod class path: [select your module]
If you are having trouble creating a JUnit Run configuration, you should contact this for help.
Finally, in the latest version of Android Studio, you can launch your JUnit-Run Configuration by clicking the "Run with Coverage" button.
In Android Studio 2.1.3, the label is Run Unit tests with Coverage , where Unit test is the name of your test configuration, as shown in the following screenshot:

Caleb May 11 '15 at 21:08 2015-05-11 21:08
source share