Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
23 views

Unable to resolve duplicate class issue while adding dependencies in Android gradle for writing instrumented tests for Composable UI

I have a complex project where version for org.jetbrains.kotlinx:kotlinx-coroutines-android is forced to 1.6.4. I have used Jetpack composables for my UI screens. I want to write Instrumented Tests ...
Sarfaraz's user avatar
  • 376
0 votes
0 answers
12 views

Run Roboelectric in Unit Testing and Most Efficient way to perform instrument test at physical device

I'm doing some old codelab on testing here, But in the codelab it uses Roboelectric in UnitTest folder, but when I run that it stuck on this part Here's the code. @RunWith(AndroidJUnit4::class) class ...
archisei's user avatar
0 votes
0 answers
28 views

Android FragmentScenario androidTest prevent running network calls on launch and view model testing

I have an existing fragment class as part of a navigation graph component and uses Dagger to create instances of ViewModels scoped to the nav graph. However, I have a few questions about ...
MajinKenn's user avatar
0 votes
0 answers
47 views

AmbiguousViewMatcherException in instrumented espresso tests matching two views due to filter clause not having the intended effect

I struggle with the implementation of an instrumented test based on androidx and espresso. I am trying to prepare a ViewInteraction in a generic way, since I require the same in multiple actions ...
arkascha's user avatar
  • 42.7k
3 votes
1 answer
66 views

Android instrumented tests not all played on some devices

I have an Android app with 225 espresso tests. Up to now, I have always been able to run all tests in a raw on all devices (Samsung smartphones and tablets, from Android 7 to 14) I now have a brand ...
Laurent D.'s user avatar
0 votes
1 answer
37 views

NoMatchingViewException error during Espresso test

I am doing an instrumentation test of Fragment is displayed or not. When I start the test it execute, I am able to see FragmentLogin view in physical device but test fail by saying androidx.test....
Dnveeraj's user avatar
  • 138
0 votes
0 answers
28 views

How to set up NavHost for android UI testing?

java.lang.IllegalArgumentException: Cannot navigate to NavDeepLinkRequest{ uri=android-app://androidx.navigation/movies/ }. Navigation graph has not been set for NavController androidx.navigation....
RocketMan's user avatar
1 vote
0 answers
78 views

Why Android enforces me to use Hilt if I want to test @AndroidEntryPoint annotated classes (UI TEST) but hilt can not provide Activity object

I am trying to test a Main Activity class that is @AndroidEntryPoint using Hilt Testing in my Android application. The PermissionHelper class is defined as follows: public class PermissionHelper { ...
Nadin Martini's user avatar
1 vote
0 answers
62 views

How to exclude app module from instrumented test?

After running ./gradlew connectedAndroidTest and removing androidTest directory and the any required setup with instrumented test from my app module build.gradle.kts, the task :app:...
Bitwise DEVS's user avatar
  • 3,370
0 votes
0 answers
25 views

How to test composables background?

I have an application written in compose and I want to test it's background based on state stored in viewmodel and interaction with the composable item, like: Box( modifier = Modifier ...
Arman TabibZadeh's user avatar
0 votes
0 answers
147 views

Cannot run Android Instrumentation test when enable R8

My app recently enabled the R8. My app can run fine when R8 is enabled. The UI Test can run when R8 is disabled, but when enabled, I got the "Caused by: java.lang.ClassNotFoundException: Didn't ...
Khoa Chau's user avatar
1 vote
1 answer
410 views

Kotlin Compose instrumented UI test: How to perform drag and drop on the screen?

I'm currently working on a composable screen that looks something like this: Those tiles are draggable, you can reorder them by dragging it and moving it to another place. And this is what I want to ...
krm's user avatar
  • 11
0 votes
0 answers
163 views

How to fix Java.lang.IllegalStateException: Given component holder class androidx.activity.ComponentActivity does not implement interface dagger.hilt

I have a compose screen and inside my screen, I am initialising my viewmodel. I am trying to write androidTest for this screen. And I am getting above error. How should I modify code to avoid ...
Heleena Joy's user avatar
0 votes
0 answers
38 views

Interpreting Coefficients in 2SLS Model

I am currently working on a 2SLS model where I instrumented the logarithm of per capita transfers with the unemployment rate from each country that the transfers originate from (also taking logarithms—...
Isabel's user avatar
  • 1
1 vote
1 answer
258 views

Run instrumented test with Gradle while skipping build and installation

Is there a way to run instrumented test with Android Gradle Plugin without running a build task and installation task? I need to do the installation of test APKs via adb for a very specific reason, ...
Undefined function's user avatar
0 votes
0 answers
27 views

Does Dagger 2 supports Instrumented Test in Android?

Is it possible to use Dagger 2 Android for instrumented test in a multi module project? I can't see related articles and SO question so here it is. Custom runner /** * Custom AndroidJUnitRunner to ...
Bitwise DEVS's user avatar
  • 3,370
0 votes
1 answer
113 views

Google Truth.assertThat.contains does not behave similar to List.contains

Using List.containsAll() and Truth.assertThat(list).contains(originalList) behaves differently. Working as expected assertThat(getItemsByChannelId.containsAll(entitiesChannelAPage2)).isTrue() Not ...
Bitwise DEVS's user avatar
  • 3,370
0 votes
0 answers
21 views

Zero tests started with gradle connectedAndroidTest or gradle connectedDebugAndroidTest

I have some Espresso tests in Android studio in kotlin Executed "gradle connectedAndroidTest" and "gradle connectedDebugAndroidTest" from cmd having emulator from Android studio ...
vasut alexandru's user avatar
0 votes
1 answer
63 views

Run instrumented test inside module's androidTest

Is it possible to run an instrumented test in an Android module that has no activity but uses AppCompat dependencies? I am attempting to run a simple test but only works if moved to app module. Util ...
Bitwise DEVS's user avatar
  • 3,370
0 votes
0 answers
98 views

Android Java Room.inMemoryDatabaseBuilder for Instrumented tests using Espresso

I need help to use Room.inMemoryDatabaseBuilder for my Instrumented tests In my Instrumented class I added this : private MyDatabase database; @Rule public InstantTaskExecutorRule ...
GreatMangaka's user avatar
2 votes
1 answer
282 views

Android instrumented tests BouncyCastle exception

Some time ago, my instrumented tests stopped working. I get an exception trying to sign the test apk from BouncyCastle. I did a git bisect to find the commit where the tests stopped working. I ...
johngray1965's user avatar
2 votes
0 answers
99 views

Override resource files in Android instrumented tests

Disclaimer: related but different from this, this and this. I would like to point AndroidManifest.xml to an xml resource file like this: <application [...] android:...
JonasVautherin's user avatar
1 vote
0 answers
338 views

Instrumented test uses main AndroidManifest instead of the test version

I am trying to uses OkHttp in some Android instrumented tests, but I get the following error: java.net.UnknownServiceException: CLEARTEXT communication to localhost not permitted by network security ...
JonasVautherin's user avatar
2 votes
0 answers
278 views

Why is it so slow to start instrumented test in Android Studio?

I have the latest version on Android studio (Giraffe) And I have built a very small app from the project wizard (the "empty activity" template) When I run the app several times consecutively,...
Laurent D.'s user avatar
9 votes
4 answers
1k views

App is uninstalled after playing instrumented tests since migration to Giraffe

I have used Flamingo for some time, and after playing an Espresso test, the app was still installed. Then I upgraded to Giraffe, and now, after playing an Espresso test, the app is uninstalled. I did ...
Laurent D.'s user avatar
0 votes
1 answer
160 views

In a Hilt Instrument Test, can you have two ViewModels for @BindValue?

I am having some issues with a instrument test using Hilt. The problem is that I have to deal with two viewModels, one for the activity and then one for the base class. Here is what I have: @RunWith(...
Kristy Welsh's user avatar
  • 8,490
2 votes
0 answers
350 views

kotlin android junit4 parameterized test

i got an issue, i try to do a multi argument parameterized test with junit for instrumented test: @RunWith(Parameterized::class) class PileAddEditTopbarColorTest( private val ...
arist0v's user avatar
  • 159
0 votes
1 answer
439 views

How to retry on failed Android instrumented tests?

I'm searching for a way to retry run failed Android instrumented tests or called integration tests/ui tests. I think there could have 3 ways of doing this. Retry with Jenkins stage script -> ...
Zhou Haibo's user avatar
  • 2,058
0 votes
1 answer
228 views

instrumentTesting with Espresso when facing with Splash Screen API and Navigation

How to perform Instrumental Testing or Android Testing when using Splash Screen API and Navigation. As we know, Activity is no longer needed to create splash screen, we just need to make new Theme to ...
dans's user avatar
  • 27
1 vote
1 answer
397 views

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' -- ...
Xena Warrior Princess's user avatar
0 votes
1 answer
452 views

How to run/invoke Instrumented Tests from within Android App code (MainActivity)

In the current arrangement, on Android, Instrumented Tests can be invoked by following approaches: From within Android Studio -> Right click on the class saved under "androidTest" Fire ...
GBN's user avatar
  • 1
0 votes
1 answer
363 views

Is there any way to make the application not restart at each @Test while running the android UI tests, but run all the testcases without restarting?

In the app I'm testing during onboarding there are tutorial screens that I want to test in separate @Tests, but between tests the app quits and restarts and this causes the tutorial to skip and jump ...
Gábor Tachtler's user avatar
9 votes
3 answers
2k views

com.android.tools.r8.internal.Jc: Space characters in SimpleName exception are not allowed prior to DEX version 040

I'm trying to using backticks ` in the definition of my instrumented tests. I don't understand why compiler complains about a strange error: Caused by: com.android.tools.r8.internal.Jj: com.android....
Nicola Gallazzi's user avatar
0 votes
0 answers
152 views

INSTALL_FAILED_UPDATE_INCOMPATIBLE when restoring from AVD cache for CI/CD pipeline instrumented tests

I'm trying to make a github actions workflow to run instrumented tests on Android. My file has steps similar to: actions/checkout@v3 actions/setup-java@v3 gradle/gradle-build-action@v2 actions/cache@...
SmallGrammer's user avatar
  • 1,353
1 vote
1 answer
315 views

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....
Crocodile's user avatar
  • 5,825
8 votes
3 answers
6k views

How to iterate over an element (node) list on Android Jetpack Compose UI Tests?

I'm implementing some instrumented tests using the Jetpack Compose testing library. I'm not too familiar with Kotlin / Android development yet, but I have years of experience with Selenium and other ...
luis's user avatar
  • 81
0 votes
1 answer
879 views

Android Studio can not find instrumented tests

I have an app with two flavour versions (pro and light) and I want to run instrumented tests. So I add two extra directories androidTestLight and androidTestPro (have three test folders androidTest, ...
Mr T's user avatar
  • 53
24 votes
3 answers
7k views

Android studio Instrumented Test stuck at: Task :app:connectedDebugAndroidTest

I have encountered a problem that when I tried to run Android Instrument test, android studio will start building, everything is good until it stuck to this line "> Task :app:...
GAME TTXD's user avatar
  • 271
0 votes
1 answer
397 views

How to get lifecycle owner in instrumented test android?

I have view model which can be provided via such code: val retrofitService = RetrofitService.getInstance(requireContext()) val mainRepository = MainRepository(retrofitService) val viewVM = ...
Andrew's user avatar
  • 2,147
0 votes
0 answers
322 views

How to make instrumented test if I need to use @Composable?

I had an instrumented test that worked, however, then was added additional param to the object which required to call the @Composable function, so the entire test method should be marked as @...
Sirop4ik's user avatar
  • 5,183
1 vote
2 answers
1k views

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'...
Ridje's user avatar
  • 103
1 vote
1 answer
615 views

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 ...
aormsby's user avatar
  • 176
2 votes
0 answers
678 views

Android instrument test in gitlab CI/CD runner, installed on a virtual machine

I'm struggling to run an android emulator in a GitLab CICD job. Right now we have Proxmox virtualization on bare metal which hosts some VMs. One of the VMs is a GitLab runner. The runner uses the ...
Ali Golmirzaei's user avatar
0 votes
1 answer
106 views

How do you get access to a testing device's files when running instrumentation tests for Android

I have set up a physical device with files that can be retrieved through the MediaStore. My goal is to retrieve these files through the MediaStore in an instrumented test. Currently, when I push the ...
John Glen's user avatar
  • 937
0 votes
0 answers
206 views

How can I fake dagger injection for Instrumented test in dynamic-feature modules?

I have a simple Note Taking Application. The Application has an app gradle module and editnote gradle dynamic feature-module. Hence my editnote gradle module will depend on app gradle module [because ...
user1105872's user avatar
0 votes
1 answer
118 views

Exchange testInstrumentationRunner with a runner derived from class not available at compile time

I want to use a custom testInstrumentationRunner for overriding the newInstance method in order to use a custom application: class UiTestJUnitRunner : AllureAndroidJUnitRunner() { override fun ...
ceedee's user avatar
  • 401
2 votes
1 answer
5k views

./gradlew connectedVariantNameAndroidTest failed

At Android studio's terminal key in "./gradlew connectedVariantNameAndroidTest". Result with following error message: Task :app:connectedDebugAndroidTest FAILED FAILURE: Build failed with ...
Squall Huang's user avatar
0 votes
1 answer
596 views

Composable does not remember input when changing configuration in test

I'm writing instrumented tests for a Jetpack Compose component. My composable uses rememberSaveable to remember between configuration changes (activity restarts): @Composable fun AddUserScreen() { ...
Mahozad's user avatar
  • 24.1k
1 vote
0 answers
613 views

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 ...
Roop Kishore's user avatar
3 votes
1 answer
339 views

Why instrumented room test get error FOREIGN KEY constraint failed

I don't understand this error, I have two entities Task and Project, one task is assign to one project (see code below). But when I want test to add a task, I have this error: android.database.sqlite....
mabdelouahad's user avatar