Home:ALL Converter>Gradle, Robolectric, and Espresso

Gradle, Robolectric, and Espresso

Ask Time:2013-12-03T06:08:23         Author:loeschg

Json Formatter

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.

Author:loeschg,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/20338926/gradle-robolectric-and-espresso
plackemacher :

For a good example of Robolectric and Espresso working together in harmony, check out this sample project created by the Robolectric team:\n\nhttps://github.com/robolectric/deckard-gradle",
2014-03-31T19:54:49
yy