Search code examples
android-studiojunitrobolectrictest-coverage

Run tests with coverage in Android Studio 2.3


In the new version of Android Studio, 2.3 Canary, I no longer have the "Run with Coverage..." option for tests.

Does anyone know if the option was somehow integrated into another mechanism, or was it removed altogether?

I hope not, that would be really bad, as I strongly relied on it when doing TDD with Robolectric :-( While the option to put a picture in the editor background is nice - having a cat stare at me for 8h is cool - not getting coverage reports is a rather high price to pay... :-(


Solution

  • The option is back in Android Studio 2.3 Canary 3! :D


    EDIT:

    However, it seems broken :-( After running it once the IDE decided to say I have no tests in the suite :-(

    However, there is a way to enable it in 2.3.2:

    1. Download 2.3.3., open the archive, go to folder named plugin, then to coverage and copy the BUILD file you will find in there.
    2. Go to your 2.3.2. installation, and also open plugin and then coverage (the plugin was in 2.3. all the time, just inactive!)
    3. Paste the BUILD file here and start Android Studio 2.3.2. You should now have access to Run with Coverage option :-D