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.

Testing async tasks with robolectric

Do you know how to implement unit testing for AsyncTasks using Robolectric ? Any pointers will be appreciated.

android unit-testing robolectric
How to test an IntentService with Robolectric?

I'm trying to test the onHandleIntent() method of an IntentService using Robolectric. I'm starting the service with: Activity activity = new …

android android-testing robolectric
How to debug when running Robolectric tests in Android Studio?

I need to run debug while my tests execution in Android Studio + Robolectric. Each time I try to run them …

android debugging gradle android-studio robolectric
Simulating a click on a menu item in Robolectric

It's fairly simple to simulate a button click in Robolectric: Button someButton = (Button) findViewById(R.id.some_button); someButton.performClick(); …

android robolectric
How to specify classpath ordering in Gradle

I need to control the ordering of jars in the testRuntime configuration. I must make sure that robolectric-x.x.jar …

unit-testing gradle robolectric
How can I shadow the PackageManager with Robolectric

My Android application has a simple method to fire off an intent to display a URL. protected void launchBrowser(int …

android shadow robolectric
Robolectric ContentProvider testing

I have noticed that every now and then there is a question about using Robolectric for testing custom ContentProviders. However, …

android unit-testing robolectric
How does exactly custom Shadow objects work in Robolectric?

If I write a custom Shadow for my Activity, and registering it with RobolectricTestRunner, will the framework intercept the Activity …

android unit-testing robolectric
Mock Retrofit Observable<T> response in Android Unit tests

I have an API interface and I'm testing a View that involves network calls. @Config(emulateSdk = 18) public class SampleViewTest extends …

android unit-testing mockito robolectric retrofit