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.

Mock class in class under test

How I can mock with Mockito other classes in my class which is under test? For example: MyClass.java class …

java unit-testing junit4 mockito robolectric
How to run unit tests with Android Studio

I'm using Jake's Android unit tests plugin for gradle: https://github.com/JakeWharton/gradle-android-test-plugin My build.gradle looks like this: …

android junit gradle android-studio robolectric
How can we access context of an application in Robolectric?

Actually, I need to get a response of an API call, for that I required Context.

robolectric
How can I test fragments with Robolectric?

I know there is a Robolectric.shadowOf(Fragment) method and a ShadowFragment class, thought they aren't listed on the docs, …

android robolectric
Does Robolectric require Java 9?

All the tests are passing, but I get the below warning. Robolectric is telling me that Java 9 is required. I …

android unit-testing robolectric
junit testing with gradle for an android project

I am trying to get tests ( junit and robolectric ) working in an Android project but am totally stuck. My main …

android junit gradle junit4 robolectric
Robolectric vs Android Test Framework

Does Robolectric provide any clear benefits compared to Android Test Framework ? I've read the docs regarding both the frameworks but …

android robolectric
Testing that button starts an Activity with Robolectric

Hi I have the following code: @RunWith(Test9Runner.class) public class MainActivityTest { private MainActivity activity; private Button pressMeButton; @Before …

android android-activity android-intent robolectric
Android Unit Test with Retrofit2 and Mockito or Robolectric

Can I test real response from retrofit2beta4? Do i need Mockito or Robolectic? I don't have activities in my …

android unit-testing mockito robolectric retrofit2
Confused about testCompile and androidTestCompile in Android Gradle

I'm new to testing world and even more to Android testing world. While doing research on Robolectric that aids with …

android gradle android-gradle-plugin robolectric android-testing