In this Espresso testing tutorial you’ll learn how to create UI tests with Espresso and how to leverage Screen Robots to make them clear and maintainable.
Yes! You’re exactly right that you can perform the same Espresso tests on the JVM using Robolectric an AndroidX Test. There are two trade offs to keep in mind when using this option:
The Android framework is mocked, so while it behaves just about the way you’d think, you still should keep it in mind.
I don’t think things like sensors and GPS are available using this Espresso + AndroidX Test + Robolectric.
For most cases, I doubt any of these would be an issue. Thank you for bringing it up, @igorganapolsky !