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

Robolectric tests not running (Android)

I have successfully installed Robolectric, but my tests are not running at all. There are no errors, but also no results. What did I miss? After running ./gradlew test there are no test reports, but test-classes are generated properly My…
Anna
  • 147
  • 1
  • 1
  • 9
1
vote
2 answers

Android Studio Robolectric resource folder

I have a workspace in the android studio that consists of the app projects and dependency android library project. I have a unit test in the app project that tests the class that loads the string from both app project resources and the dependency…
user1744147
  • 1,099
  • 13
  • 30
1
vote
1 answer

Error : Could not resolve all dependencies for configuration ':app:testCompile` in Robolectric

Hi I am writing unit test cases of my demo android application, so for this I am using robolectric unit framework. When I run it gradlew test then it gives error Could not resolve all dependencies for configuration ':app:testCompile`. Please see…
N Sharma
  • 33,489
  • 95
  • 256
  • 444
0
votes
0 answers

Test case getting failed after robolectric library updatded to 4.9.0 getting status code 403 from server: Forbidden

FAILURE: Build failed with an exception. What went wrong: Execution failed for task ':app:kaptGenerateStubsDebugUnitTestKotlin'. Error while evaluating property 'filteredArgumentsMap' of task ':app:kaptGenerateStubsDebugUnitTestKotlin' Could not…
0
votes
1 answer

AndroidStudio not automatically importing RoboLectric objects

After setting up gradle properly, when i add for example @RunWith(RobolectricTestRunner::class) at the top of my test class, Andtoid studio does not import the class automatically when I click Alt+Enter. When I manually type import…
0
votes
1 answer

Robolectric 4.0.2 test are not running in gradle 3.2.1 with NoSuchMethodError: setUseLegacyResources(Z)V

I have upgrade my Gradle plugin version from 2.3.3 to 3.2.1 and than my robolectric test start failing. So i upgrade the robolectric version to 4.0.2 with given changes in Documentation. But still all my test are not able to execute with this error…
0
votes
1 answer

Android : Migration from dagger 1 to dagger 2 for unit tests stuck with below error

13:37:25.068 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.NoClassDefFoundError: dagger/ObjectGraph 13:37:25.068 [ERROR] [org.gradle.BuildExceptionReporter] at…
user3912899
  • 65
  • 1
  • 8
0
votes
1 answer

Android robolectric tests manifest merge issue (android beacon library)

I have the simple Test Case @Config(constants = BuildConfig.class) @RunWith(RobolectricGradleTestRunner.class) public class BaseTest { @Test public void startEverTestSugarAppAsFirst() { …
0
votes
0 answers

MaxPermSize=2048m and yet I get "GC overhead limit exceeded at "

I'm running the gradle of an existing android-studio project and get an error of lack of memory. even though i have this in my gradle properties: org.gradle.jvmargs=-XX:MaxPermSize=2048m I'm using mac this is the…
Elad Benda
  • 35,076
  • 87
  • 265
  • 471
0
votes
0 answers

Robolectric getNextStartedActivity always returns launcher activity

I'm trying to test that calling a simple method in my Android app will start another activity. getNextStartedActivity always returns the launcher activity. Here is the test: @Test public void clickingButton_shouldStartNextActivity() throws Exception…
mravca
  • 699
  • 1
  • 6
  • 11
0
votes
1 answer

Configure Robolectric in build.gradle

Can anybody explain me how to make robolectric to work with gradle in android studio? I've tried many times with different configurations but nothing works. Maybe this is a simple question but I now have no idea how to do this. I use android studio…
user3504091
  • 51
  • 1
  • 9
0
votes
0 answers

Run Robolectric with proguard

These are the test dependencies: // tests androidTestCompile 'org.mockito:mockito-all:1.10.8' androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.3.1' androidTestCompile 'junit:junit:4.12' androidTestCompile…
Diolor
  • 13,181
  • 30
  • 111
  • 179
0
votes
1 answer

Running Robolectric unit tests fails

i am trying to build and run unit tests via Robolectrie test framework but i am unable to do so due the actual plugin i use Here is my build script i tried //http://tools.android.com/tech-docs/new-build-system/migrating-to-1-0-0 buildscript { …
Jono
  • 17,341
  • 48
  • 135
  • 217
0
votes
0 answers

Testing if an activity was recreated

I am having trouble testing a method in an activity that is supposed to recreate the activity using robolectric. The method code is along the lines of: public void onSomeEvent(Event event) { // ... do stuff ... recreate(); } As long as I…
Saad Farooq
  • 13,172
  • 10
  • 68
  • 94
0
votes
1 answer

Run robolectric and android unit test from Android studio

I currently have various AndroidTestCases which use Mockito and the module dexmaker-mockito. I am now trying to add Robolectric test cases using the robolectric plugin. I have everything running fine except that when I try to mock methods with no…