Framework for Android instrumented testing to interact with UI components.
Questions tagged [instrumented-test]
116 questions
1
vote
1 answer
Running Tests doesn't work properly. Test Results 0/0 Android Instrumented Tests
After updating my project with following dependencies my tests stoped running.
mockitoVersion = '5.3.0'
dexMakerVersion = '2.28.3'
espressoVersion = '3.5.1'
--
androidTestImplementation "org.mockito:mockito-core:$mockitoVersion"
…
1
vote
0 answers
androidTest not giving any result
I am running a UI test but it just keeps loading and not giving any success or failed but same code if I am running test on another Android Studio it is giving success. I've reinstalled the Android Studio also but no result.
Android Studio Version -…

user12692788
- 39
- 3
1
vote
1 answer
How to access application overlay windows from Android tests?
The app I am working on has an application overlay window implemented as floating button. It's defined with type as:
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O)
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT else…

Crocodile
- 5,724
- 11
- 41
- 67
1
vote
2 answers
Testing WorkManager with custom initializer and Hilt
I am trying to implement instrumented test for my custom Work Manager which uses Hilt's @AssistedInject.
My Work Manager performs perfect in an app but when I am trying to test it according to Google's work manager integration test guide I'm getting…

Ridje
- 93
- 1
- 1
- 5
1
vote
1 answer
Android instrumented tests - Recreated Activity not picking up locale change, API <33
At least, it's not doing what I'd expect. Here's my situation --
I'm writing a feature to allow that allows users to make locale changes at runtime. Without any special handling, a locale change will automatically recreate Activities and use the…

aormsby
- 126
- 5
1
vote
0 answers
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/io/FileTestStorage;
Firstly I did not have androidTest Package in my App, So I created using Run-> Record Espresso Test, So it Created an androidTest package. But Getting this Exception in Logcat while running an Instrumented test. I have Gone through lot of solutions…

Roop Kishore
- 199
- 1
- 11
1
vote
0 answers
Run connected test from terminal with dynamic module (dynamic module is not included in the test)
I'm trying to run connected instrumented tests from the terminal, but some tests are failing since the dynamic module is not included in the target apk. When I run these tests from Android Studio then tests are successful.
I'm using the following…

user2875643
- 93
- 2
- 3
1
vote
1 answer
context.startActivity not working for a single app in UiAutomator
I'm trying to launch a 3rd-party app using UiAutomator with this code:
val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
device.pressHome()
val context =…

artem
- 16,382
- 34
- 113
- 189
1
vote
1 answer
Android how to get XML output of Instrumented Tests
For the CI testing of my Android App I wrote some unit tests and let them run via gradle from the terminal. They all produce the typical junit XML output files in the build/test-results folder like that:

Tobias Reich
- 4,952
- 3
- 47
- 90
1
vote
0 answers
How to catch Errors in Activities when running Instrumented Tests in Android?
I have an Activity SomeActivity. To properly work, it needs an id. This id is passed in the Intent.
SomeActivity retrieves in its onCreate-Method the id from the Intent. If it is null, it throws an Error (which crashes the Activity).
I want to test…

imnewplsdonthate
- 31
- 3
1
vote
0 answers
Launching instrumented tests on REAL DEVICE produces timed out waiting for process to appear - MacBook Air M1
I'm stuck on a time out error, and after reading about all the subjects on Stack Overflow I can't find a solution for my problem.
I'm trying to launch an instrumented test from Android Studio (last version) on a real device (I tried different…

Blou
- 11
- 1
1
vote
2 answers
"com.android.test" module for both ":app" and ":dynamicfeature" failing with "Collection has more than one element." : "testedApplicationId"
I try (in a sample app), to have one single ":test" module testing the main module ":app" and ":dynamicfeature" module.
For that, I use the "com.android.test" gradle plugin.
My ":app" module runs just fine. It instanciates a basic view from my…

michgauz
- 214
- 2
- 10
1
vote
0 answers
Can we able to test static boardcast receivers in Instrumetation tests or boardcast receivers should be tested in unit test only
I am new to Android and its Instrumentation testing
I am having a boardcast receiver registered in my android manifest like

senthil vel
- 71
- 5
1
vote
0 answers
Android Instrumented Test - Mocking Location doesn't work (returns null although testLocation is set)
My application works perfectly but now I have to test a class which gets the Location via the LocationManager so I decided to activate Mock Location in the Manifest:

Majin
- 11
- 2
1
vote
1 answer
Android Tests: java.lang.ClassNotFoundException
I have created this android test:
package fr.tisseo.android.repository.productlocalization.tests
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
import org.junit.Test
import…

Kevin ABRIOUX
- 16,507
- 12
- 93
- 99