Top "Robolectric" questions

Robolectric is a unit testing framework that allows Android applications to be tested on the JVM in seconds without using an emulator or device.

Robolectric RuntimeEnvironment.application is deprecated, where is ApplicationProvider.getApplicationContext()?

I switched to Robolectric 4.0 Beta 1 from 3.8 because I need compatibility with Android 9 (API 28). With this change, RuntimeEnvironment.application is now …

android robolectric android-9.0-pie
Build local unit tests (No instrumentation registered! Must run under a registering instrumentation)

Take a look at the official documentation. The section Include framework dependencies gives an example of how to set up …

android unit-testing documentation robolectric
Unit Test Cases with JUnit +(Robolectric or Mockito or both in Android)

This is first time I have to write unit test cases in Android. So I have searched lots of things. …

android mockito junit4 robolectric
attempting to unit test and something with RoboGuice.newDefaultRoboModule() is failing with Roboguice 2.0b3 and Robolectric

I've been looking at the astroboy example code and documentation for RoboGuice 2, and I'm honestly stumped. I hope you all …

dependency-injection android-2.2-froyo roboguice robolectric
Robolectric: IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity

I'm new to Robolectric and instrumentation testing in general on Android. I followed along the guide for Robolectric for testing …

java android functional-testing robolectric illegalstateexception
Gradle + Robolectric: Where do I put the file org.robolectric.Config.properties?

I'm trying to setup a test using Robolectric to click on a menu button in this repository. Basic Robolectric tests …

android unit-testing testing gradle robolectric
Android: Robolectric does not support API level 1

This is my basic test class: @RunWith(RobolectricTestRunner.class) public class MainActivityTest { @Before public void setup() { //do whatever is necessary …

android junit4 robolectric
Android Testing Handler.postDelayed

I'm newbie on Android and get stuck on testing a SplashScreen, basically what I'm doing is trying to test that …

android unit-testing handler robolectric postdelayed
Unable to locate a Java Runtime Android Studio Robolectric

I've added Robolectric to an Android project. I'm using Android Studio with Build Tools in 19.0.1. I can run the tests …

android android-studio robolectric
Jvm options in android when run gradlew test

I have a project that using Robolectric for unit test purpose. This project uses Robolectric 3.0 and need to add -ea …

android unit-testing gradle android-gradle-plugin robolectric