Roboeletic example in kotlin. Running tests on an Android emulator or device is slow! Building, deploying, and launching the app often takes a minute or more. That’s no way to do TDD. There must be a better way.
Robolectric is a unit test framework that de-fangs the Android SDK jar so you can test-drive the development of your Android app. Tests run inside the JVM on your workstation in seconds.
Starting a New Project
If you'd like to start a new project with Robolectric tests you can refer to deckard (for either maven or gradle) as a guide to setting up both Android and Robolectric on your machine.
<dependency> <groupId>org.robolectric</groupId> <artifactId>robolectric</artifactId> <version>3.5.1</version> <scope>test</scope> </dependency>
Android Engineer, Dharma Kshetri