Gradle, Robolectric, and Espresso
android, android-espresso, android-studio, gradle, robolectric
Solution
For a good example of Robolectric and Espresso working together in harmony, check out this sample project created by the Robolectric team:
https://github.com/robolectric/deckard-gradle
Problem
Has anyone successfully gotten Robolectric and Espresso working (together) when building with Gradle (Android Studio)? I've gotten Robolectric working in Android Studio due largely to Peter Friese's post http://www.peterfriese.de/android-testing-with-robolectric/, but I'm unsure of how to integrate Espresso due to instrumentRunner/instrumentTest collisions. Ideally I'd have a directory structure like the following: ``` |--src └── main (application source - exists) └── test (Robolectric unit tests go here - exists) └── testEspresso [*new*] (espresso tests go here) ``` My Gradle+Android knowledge isn't very extensive, and I'm unsure of whether this is really a feasible thing (time, complexity, and fragility levels aren't too extreme) given the current state of Gradle+Android and if it is, how to go about doing so. Also in case it's of relevance, I have 2 different build flavors.