robolectric Questions

7

I finally have a Test Case setup for Roboelectric but when I try to run it from Android Studio, get this error: Task 'testClasses' not found in project 'myExternalProjectName' Error:Could not exec...
Neau asked 7/4, 2016 at 2:46

7

Solved

I wanted to generate code coverage reports on my JUnit tests in my android project so I added the JaCoCo gradle plugin. This is my project level build.gradle file: apply plugin: 'jacoco' buildscr...
Acroterion asked 1/3, 2016 at 22:42

3

In its simplest form I have this dialog: @Composable fun MyDialog( showDialogState: MutableState<Boolean> ) { if (showDialogState.value) { AlertDialog(onDismissRequest = { showDialogState...

4

In my robolectric test i wrote a @Rule public ActivityScenarioRule<AppCompatActivity> activityScenarioRule = new ActivityScenarioRule<>(AppCompatActivity.class); @Rule public Ac...
Gaffer asked 11/4, 2019 at 14:55

2

I am using this statement "ResourceResources.getSystem().getDisplayMetrics().scaledDensity" in my android project in order to get the scaled density. When I'm writing unit test it says Resources cl...
Eleanoraeleanore asked 18/1, 2017 at 11:54

3

It seems to me that building an Activity unit test with Robolectric's lifecycle utilities (starting with Robolectric.buildActivity()) and spying on the same Activity with a Mockito spy are mutually...
Karisakarissa asked 16/10, 2013 at 16:14

3

I'm following this http://robolectric.org/getting-started/ but I'm getting: Error:(61, 0) Could not set unknown property 'includeAndroidResources' for object of type com.android.build.gradle.inte...
Vladimar asked 13/7, 2017 at 11:21

6

Solved

I'm trying to use Robolectric to run unit tests but the Android Studio is not recognizing the class on: @RunWith(RobolectricTestRunner.class) Details: classpath 'com.android.tools.build:gradle:...

1

Solved

I wrote a Unit-test with RobolectricsTestRunner included. The unit test passed, but with the following warning: System.logW: No Compatibility callbacks set! Querying change 119147584 All I did in ...
Pyrochemical asked 14/12, 2021 at 14:42

7

Solved

I'm trying to run a test with Robolectric and it has an integration with Firebase. I have a project MyProject - Test that I'll be using to run the tests in a real instance of the database. The pro...

2

Solved

I'm attempting to write a few testcases that work against the Android Keystore. However, when I write the following test case: @RunWith(RobolectricGradleTestRunner.class) @Config(constants = Build...
Glyph asked 5/7, 2016 at 22:18

3

Solved

I have an android project setup with robolectric tests with a total of around 2084 unit tests right now. But I have been running into issues adding more tests because of the java.lang.OutOfMemoryEr...
Fay asked 1/1, 2015 at 1:17

6

I am using Robolectric library and the latest version of it v4.3.1 requires Java 9 to run. I am trying to point JRE on edit configurations but I am not finding Java 9 in the drop-down, even though ...
Cicelycicenia asked 23/10, 2019 at 6:27

7

My Android application has a simple method to fire off an intent to display a URL. protected void launchBrowser(int id) { Uri uri = Uri.parse( getString( id ) ); Intent intent = new Intent( ACT...
Chester asked 15/10, 2012 at 19:38

1

Unit test errors with this Called loadFromPath(/system/framework/framework-res.apk, true); mode=binary sdk=28 java.lang.Exception: Main looper has queued unexecuted runnables. This might be the ca...
Saccharoid asked 30/3, 2021 at 22:18

2

I have a few buttons, on clicking on them i open different dialog fragments. I want to know how to test whether does dialog open ? or if it opens is it of correct type? Please Help. Thanks in adva...
Masticate asked 11/11, 2014 at 7:18

2

Solved

I'm having trouble creating a unit test without needing robolectric. I am using AndroidThreeTen.init(this) in my code and when I run my test if I disable robolectric I get an error: org.threeten.bp...
Ultima asked 25/3, 2019 at 14:52

1

Solved

I am trying to set up unit tests for my application. But I am facing an issue with Segment This is my test class: @RunWith(RobolectricTestRunner::class) @Config(sdk = [Build.VERSION_CODES.O_MR1]) c...

9

Solved

How to access files from assets folder during unit tests execution? My project is build using Gradle, I use Robolectric to run tests. It seems like gradle is being recognizing the assets: This i...
Melva asked 7/11, 2014 at 15:33

5

Solved

Error: java.lang.IllegalArgumentException: failed to configure : Package targetSdkVersion=30 > maxSdkVersion=29 at org.robolectric.RobolectricTestRunner.getChildren(RobolectricTestRunner.java:2...
Kilgore asked 4/9, 2020 at 7:58

0

Assumptions Robolectric controls which Android version to emulate, so I need this AndroidX has the test API for Jetpack Compose, so I need this as well Background I have experienced a lot of AppN...

3

Solved

I'm running into the following crash and stack trace after upgrading to Moshi 1.9.1 (from 1.8.0): java.lang.IllegalArgumentException: Cannot serialize Kotlin type com.garpr.android.data.models.Ran...
Suprasegmental asked 3/11, 2019 at 4:4

3

Solved

All my Unit Test started throwing this error: No such manifest file: build\intermediates\bundles\debug\AndroidManifest.xml java.lang.NullPointerException at org.robolectric.shadows.ShadowAssetMa...
Boot asked 13/3, 2017 at 23:31

5

I have noticed that every now and then there is a question about using Robolectric for testing custom ContentProviders. However, there has never been a concrete and unambiguous answer on how to do ...
Medick asked 2/8, 2013 at 17:36

2

Solved

I'm using Robolectric 4.3.1 (testImplementation "org.robolectric:robolectric:4.3.1") to create an Android sqlite environment for my integration tests. My system uses OkHttp (implementation 'com.squ...
Smilacaceous asked 1/3, 2020 at 6:58

© 2022 - 2025 — McMap. All rights reserved.