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
3
votes
1 answer

Robolectric & Gradle: error: cannot access BufferedImage class file for java.awt.image.BufferedImage not found

I made fairly deep research in stack overflow but I haven't found solution so far. I have come across the error from Android Studio when running Robolectric test. My project looks this way: project -app -src -main -test …
2
votes
1 answer

java.lang.IllegalAccessError while using Robolectric 3.6.1

While I run JUnit tests, it throws the following error: java.lang.IllegalAccessError: tried to access field org.robolectric.annotation.Config$Builder.sdk from class org.robolectric.RobolectricTestRunner$1 It seems that there's sth wrong here in the…
Scott Wang
  • 489
  • 1
  • 7
  • 9
2
votes
1 answer

Robolectric 3.2.2 get instance of shadow classes?

I have implemented the MVP on my android application and am looking at creating test scripts to test basic behavior functionality. Long story short, is there a way to get an instance of the shadow object I've created? I would like to be able to…
Killesk
  • 2,734
  • 3
  • 22
  • 29
2
votes
0 answers

Adding apply plugin: 'org.robolectric' in (app)gradle file shows project refresh failed Error:The Android Gradle plugin 2.1.2 is not supported

Hi Am trying to configure Jenkins in android studio. I followed this link and i installed Jenkins in MAC system and verified with my localhost to check its running perfectly or not(as mentioned in the above link). I have added following line in my…
2
votes
0 answers

Calling View.getTop() in Robolectric always returns 0

I'm trying to verify the position of a View on screen but View.getTop or View.getLocationOnScreen() will always return 0. View.getHeight() is greater than 0 and appears to be correct. Is this a limitation of Robolectric or is there something I need…
Ljdawson
  • 12,091
  • 11
  • 45
  • 60
2
votes
2 answers

How to test ListView items from server using Robolectric 3.0

I am using Robolectric to test my Application. In my app I want to check the listview is there any items in that view. And test the onClickItem from the listview. The listview items is dynamic from server. Every time the activity is started it will…
2
votes
1 answer

Gradle Clean Build and connectedAndroidTest

I'm playing with Gradle for Android recently... It's powerful but painful at the same time. Initially, I followed Roboletric sample project, trying to make a gradle-based Android project with Robolectric testing support. After a while, I realise…
1
vote
0 answers

Application using segment analytics throwing java.lang.IllegalArgumentException: INTERNET permission is required

Problem : I am trying to run test cases for my app using robolectric. My application is segment analytics. Its throwing Internet permission exception while its already there in my manifest file. robolectric version : 3.7.1, targetSDKVersion : 26,…
Sunil Kumar
  • 61
  • 1
  • 6
1
vote
1 answer

All sorts of errors running Robolectric tests: Theme.AppCompat, NoClassDefFoundError and more

My Android project has about ~70 Robolectric tests and they were all passing for 2 months. Somehow, starting today, the tests are failing with weird error messages: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or…
Xi 张熹
  • 10,492
  • 18
  • 58
  • 86
1
vote
1 answer

Add on-device instrumented tests to a project with Robolectric tests

I have an Android project which uses Robolectric for testing. The relevant parts of build.gradle look a bit like this: apply plugin: 'robolectric' robolectric { include '**/*Test.class' } dependencies { compile fileTree(include: ['*.jar'],…
Dan Hulme
  • 14,779
  • 3
  • 46
  • 95
1
vote
2 answers

Robolectric = Mockito : Cannot Create Mock or Spy In Mockito Because: dexcache == null

I have a well reported issue here: Mockito + Dexmaker on Android However the solution does not work. I am using Robolectric and even when I try setting the dexmaker cache location: @Before public void setUp() { …
Aggressor
  • 13,323
  • 24
  • 103
  • 182
1
vote
1 answer

Robolectric 3 with Fabric Crashlytics

I am trying to ShadowClass Crashlytics/Fabric so that Robotlectric 3 tests do not fail. What I have so far is this: The custom test runner that adds the Shadow class for Fabric: public class TestRunner extends RobolectricGradleTestRunner { …
1
vote
0 answers

java.lang.NoClassDefFoundError: javax/net/ssl/DistinguishedNameParser

I'm using the robolectric unit test.I'm facing the following issue when i try to use async task with web service call. my build.gradle config android { compileSdkVersion 23 buildToolsVersion "23.0.2" useLibrary 'org.apache.http.legacy' testOptions…
1
vote
3 answers

cannot create "test" folder in android studio for robolectric

I want to add robolectric tests to my project in intellij. I have tried to follow this tutorial but I cannot add "test" package under my main module. In addition the "build variants" look different than in the tutorial. how can I fix this? how can…
1
vote
1 answer

VerifyError with ShinobiControls and Robolectric

I'm running into this strange VerifyError when trying to run Robolectric tests that call ShinobiControls under the hood. I've tried the -noverify option, but it doesn't seem to be working, or I'm putting it in the wrong place. I'm using Retrolambda,…