sharedTest pattern: sharing tests and speeding up development
After Robolectric's 4.0 release, Robolectric supports the AndroidJUnit4
test runner, ActivityScenario
, and Espresso for interacting with UI components. As we know, we also can run those tests with an official emulator. This article will show an often overlooked but widely-used pattern called sharedTest to share tests between local and instrumentation tests. This will provide the benefit of fast unit testing while ensuring that tests are high-fidelity by enabling them to be run in an emulator.