Questions tagged [robolectric-gradle-plugin]

The robolectric-gradle-plugin is a plugin for Gradle that allows Android Gradle builds to run Robolectric style tests.

The robolectric-gradle-plugin is a plugin for Gradle that allows Android Gradle builds to run Robolectric style tests.

It was originally authored by Jake Wharton and is available from Maven central.

77 questions
1
vote
0 answers

Robolectric flaky tests

I'm new to Robolectric and also to my new project, which has been written with extensive Robolectric tests. I did a ./gradlew clean test and found tests were failing randomly. I suspect there is something wrong with the @Before code but not sure…
FinalFive
  • 1,465
  • 2
  • 18
  • 33
1
vote
1 answer

Robolectric 3.0 returns null pointer

I am trying to upgrade Robolectric to 3.0. I am using RobolectricGradleTestRunner and also added @Config(constants = BuildConfig.class) above my test class. I have also tried using testCompile org.robolectric:robolectric:3.1-SNAPSHOT. Below is the…
user3773337
  • 2,086
  • 4
  • 20
  • 29
1
vote
1 answer

Robolectric 3: Shadow custom class

i'm using Robolectric 3 and i'm trying to shadow a custom class like so: public class Yakir { public int foo() { return 1; } } @Implements(Yakir.class) public class TestYakir { @Implementation public int foo() { …
1
vote
1 answer

SimpleTestCursor robolectric 3.0-- compilation issue

I am trying to test the cursor in my app. But for the following import I get the error message-- cannot resolve symbol tester. I am using Robolectric 3.0. Why the import is not resolving, am I missing some dependency? I have looked internet but no…
1
vote
0 answers

Setup Robolectric in offline mode in android studio

I am trying to Setup Robolectric in offline mode in android studio. I need it in offline mode as we need to run the tests on a Jenkins server which has no network access. I followed the "Using Robolectric in offline mode" section in the below…
1
vote
1 answer

Using Robolectric without Multidexing?

I am working on an Android application and I want to use Robolectric for testing. The main problem I have is, whenever I include Robolectric (and a few other testing libraries) to my gradle.build file, I get Dex errors so I need to enable the…
Gyoo
  • 209
  • 3
  • 15
1
vote
1 answer

LinkedIn Android SDK set up

I have started integrating LinkedIn log in to my app by following the Getting Started guide provided by developer.linkedin.com I have downloaded the mobile SDK for Android and imported the linkedin-sdk in my project. Added the following line to my…
1
vote
0 answers

Runtime exception while running robolectric 3.0 unit tests in Android studio 1.2

I am running android unit tests using Robolectric 3.0 and have run in to this runtime exception. All the tests pretty much gives the same exception. java.lang.RuntimeException: java.lang.RuntimeException: you should only be calling this from the…
1
vote
1 answer

Unable to create shadow classes with Robolectric 3

I followed the Robolectric documentation to create shadow classes but I'm not able to run shadow methods during test, it always uses original methods. This is my code: the Original class: public class Original { public void print(){ …
reevolt
  • 797
  • 1
  • 9
  • 24
1
vote
1 answer

Can't run Roboletric on windows: java.lang.NoSuchMethodException: android.os.Looper.(boolean)

I want to add support for unit tests on an existing Android Studio 1.1 project. I followed this tutorial but I am getting the error: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NoSuchMethodException:…
1
vote
1 answer

android gradle not running unit test

Hi i am trying to use and run unit tests on my android app using the Robolectric Test framework. However. when i run the command ./gradlew test it does not seem to run my unit tests at all. here is the output i get: ./gradlew test WARNING:…
1
vote
1 answer

Proguard issue Roboguice duplicate import

I am running to an issue when i run my gradle build. It seems like there are duplicate dependencies getting imported but finding it hard to debug, any suggestions would be great. Error:Execution failed for task…
1
vote
2 answers

Using multiple res folders with Robolectric

My current Gradle configuration has multiple (Merged) res folders: sourceSets { androidTest { setRoot('src/test') } main { res.srcDirs = [ 'src/main/res/features/registration', …
Luca Vitucci
  • 3,674
  • 4
  • 36
  • 60
1
vote
2 answers

Robolectric-Gradle plugin running single test

Is it possible to run single tests using Robolectric-Gradle plugin? I tried with this: ./gradlew test -Dtest.single=testName But it is not working.
Luca Vitucci
  • 3,674
  • 4
  • 36
  • 60
1
vote
0 answers

Robolectric, gradle and build types problems

I know there are plenty of post about roboelectric and gradle, but I could not set it up for my project. Let's start with the situation. My project has three buildtypes that use diferent package name for each. I'm using some SDK that require to use…
Marcel
  • 2,094
  • 3
  • 23
  • 37