2,171 questions
0
votes
0
answers
20
views
How to test Android app with Entra ID login (Espresso) and verify data saving on server?
I am developing an Android app that uses Microsoft Entra ID login for authentication.
After a successful login, the app fetches some user data and also allows saving additional data to the server.
I ...
0
votes
0
answers
25
views
Testing warm start deeplinks using ActivityScenario
I'm trying to switch from the deprecated ActivityTestRule to ActivityScenarioRule but facing an issue with some of the tests. I found out that I need to move from startActivity to ActivityScenario....
0
votes
0
answers
40
views
Jacoco report execution error for Android kotlin based project
I am trying to generate Jacoco report for Android kotlin based project. I am using Android Emulator for running androidTests and generate ec file for coverage. But facing following issue all the time.
...
1
vote
0
answers
29
views
How to test toast in Android Instrumented Test with Compose?
I want to write instrumented tests for Android UI's toasts. But it seems my codes are not working. It can't catch the toast when it's actually displayed on phone. I think possibly issue with my toast ...
1
vote
0
answers
114
views
java.lang.IllegalStateException: Expected `pm dump-profiles` stdout to be either black or saved to '/data/misc/profman/com.app.myapp-primary.prof.txt'
I am using a baseline profile for my app, and it works well when using a benchmark test for measuring performance, but when I try to run the baseline profile generator then it run the specified path ...
1
vote
1
answer
222
views
Execution Failed for Task :app:connectedDebugAndroidTest – Android Test Issue
I'm encountering a problem while running my Android instrumented tests, and after trying multiple solutions, I still haven't been able to resolve it.
Here's the error message I'm getting:
[Incubating] ...
1
vote
1
answer
135
views
Jetpack Compose test fails with "Compose did not get idle after 1610148 attempts" when running all tests together, but passes when run individually
I'm testing a DocumentCheckLoadingScreen composable using Jetpack Compose and Robolectric, and encountering a strange issue.
The test works perfectly fine while running in isolation, but fails with ...
0
votes
0
answers
28
views
Testing failing because of java.lang.AssertionError: Activity never becomes requested state
I am new to instrumented tests and I am not able to have my very first test class to run. It is failing with this error:
java.lang.AssertionError: Activity never becomes requested state
"[...
0
votes
1
answer
115
views
kotlin.test.BeforeTest is not resolved
After updating Android libraries (including Kotlin) I found that @BeforeTest became unresolved (@Before is resolved, it belongs to org.junit).
import org.junit.Before
import org.junit.Test
import org....
0
votes
0
answers
43
views
InputConnection Support on Android 9+
I feel a little lost. I've created a subclass of TextureView which should support text input via keyboard. I've tested my code on physical device with Android 12 and Emulator and it works fine. But, ...
0
votes
0
answers
33
views
Espresso 3.4.0: Certificate transparency failed
When I upgrade the Espresso Accessibility from 3.3.0 to 3.4.0 and higher, I get the following error which makes the test unable to launch the app:
SSLHandshakeException: Certificate transparency ...
0
votes
1
answer
121
views
In which package are androidx.test.core.app.DeviceCapture.takeScreenshot or androidx.test.espresso.screenshot.captureToBitmap located
I'm trying to update my screenshot routine used in the instrumentation tests of multiple projects using the new suggested method. Which is, of course, more complicated then the pervious version.
There ...
0
votes
1
answer
157
views
java.lang.IllegalStateException: Cannot move to state "RESUMED" since the Activity has been destroyed already
I have updated my test cases dependencies from this to this(as given below in code snippet ), since then I am facing this error of java.lang.NullPointerException: Cannot run onActivity since Activity ...
0
votes
2
answers
53
views
Unable to Run Kaspresso Sample: Execution failed for task ':samples:kaspresso-sample:connectedDebugAndroidTest'
I am trying to run the official Kaspresso sample project from the GitHub repository: Kaspresso on GitHub. However, when I attempt to execute the sample tests, I encounter the following error:
...
2
votes
1
answer
298
views
Does Hilt still require kaptAndroidTest when ksp is enabled for Android (Instrumentation) tests?
I'm working on an Android project where I'm using Hilt for dependency injection and have recently enabled KSP (Kotlin Symbol Processing) to replace KAPT (Kotlin Annotation Processing Tool). My setup ...
2
votes
0
answers
66
views
Generating Baseline Profiles for Features Behind Authorization Flow
I’m working on generating baseline profiles for key features in my application, such as Listing and Product Detail, which are widely used and important to users. However, these features are accessible ...
0
votes
0
answers
140
views
UncompletedCoroutinesError While Unit Testing Paging3 with kotlinx.coroutines.test in Android
Problem Description:
I'm encountering an intermittent issue while writing a unit test for fetching data using Paging3 and Room in an Android application. The test utilizes kotlinx.coroutines.test for ...
2
votes
1
answer
163
views
How do I run unit tests for single flavor without running all tests?
I'm working on unit tests for my Android app. My app has two flavors: "flavor 1" and "flavor 2", configured in default.gradle. Tests common to both are in test and I also have ...
1
vote
0
answers
142
views
How to unit test the suspend function to meet branch coverage using mockk
I wrote a Kotlin code and I want to write unit tests for it. But I found that the unit test code I wrote still cannot cover 100% branch coverage. What should I do it?
kotlin code:
class MyRepository @...
1
vote
2
answers
128
views
How to test navigation in Jetpack Compose on user click?
I have an app where I have 2 screens:
NavHost(
navController = navController,
startDestination = UserListScreen
) {
composable<UserListScreen> {
UserListScreen(
...
0
votes
0
answers
74
views
Task :app:connectedDebugAndroidTest Starting 0 tests Finished 0 tests
About Automation Testing in android kotlin|java project, using with Appium framework.
After follow Automation Testing with Appium guideline
I did run the Auto Test on RealDevie/Emulator/Simulator ...
0
votes
0
answers
54
views
Compose Multiplatform UI test in Android opens the permissions activity and sticks
I have a library that uses KMP + CMP. I want to cover the UI part with tests. for this purpose I modified the build.gradle in the following way
plugins {
alias(libs.plugins.com.android.library)
...
0
votes
1
answer
51
views
set targetSdk for androidTest apk
By default, the targetSdk of the test apk generated to run androidTest on a library is the minSdk.
Is there a way to explicitly set the targetSdk for the generated androidTest.apk to something ...
1
vote
2
answers
605
views
AndroidTest Compose IllegalStateException: Given component holder class androidx.activity.ComponentActivity does not implement interface dagger.hilt
I've seen a few things now where you are trying to inject a viewModel using hilt navigation and it is giving errors. I'm using Hilt Navigation with Compose and I'm having problems with doing UI tests.
...
0
votes
1
answer
81
views
Robolectric tests memory creep and inability to close the scenario
Some background:
My tests are using Kaspresso
Running under Robolectic.
I have Junit 5 installed, the test are Junit4 with Junit5's vintage support.
All the screens have viewModels.
the viewModels ...
0
votes
1
answer
57
views
Android Test cannot execute Fragment instrumented tests with Dagger provided ViewModel, hitting NullPointerException on ViewModelProvider param owner
I have a fragment whose instance of ViewModel is provided by a component, scoped to the navigation graph of Main Activity. The Dagger app component was injected into the single Main Activity and ...
3
votes
0
answers
174
views
Can't test Flow<PagingData<T>>.cachedIn
In my viewmodel I get a Flow<PagingData> by calling the use case in charge of doing it, and then caching it, as recommend it by android developer's guide, like this:
val bestRatedRepos: Flow<...
2
votes
1
answer
121
views
androidTest (instrumented): How to click the ALLOW button on Android 8.0 (API 26)?
For an instrumented androidTest test, I need to click the ALLOW "button" as popped up by the system when the app starts on a device running Android 8 (API 26):
(Note: on Android 14 (API 34) ...
2
votes
0
answers
157
views
Paparazzi Failed to init Bridge
Description
Fail to run basic test example
package ........
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout....
2
votes
1
answer
170
views
androidTest vs Appium -- are both needed in a given project?
The formal Android Developers documentation provides an enlightening introduction to the Fundamentals of testing Android apps.
I managed to successfully create 3 different types of test setups in ...
1
vote
0
answers
116
views
io.mockk.MockKException: Failed matching mocking signature for left matchers: [any(), any()]
I have the following kotlin code
val TAG = Logging.tag<MyClass>()
@Before
fun setUp() {
MockKAnnotations.init(this, relaxUnitFun = true)
activitySwitchManagerUtil = ...
8
votes
2
answers
2k
views
How to test SavedStateHandle in Type Safety Navigation Compose?
I'm working on an Android project that uses Type Safety Compose Navigation (androidx.navigation:navigation-compose:2.8.0-beta05). I’m trying to create a test to verify a value passed through ...
0
votes
1
answer
205
views
create android emulator with signed google playstore for github action
In my android application which build in flutter , integrated inApp purchase and written Integration test , and added it with github action test. Main problem is when emulator created on runnedd i am ...
1
vote
0
answers
138
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 {
...
1
vote
0
answers
279
views
Setting requestedOrientation results in crash
I am trying to test an Android app built with Kotlin and Jetpack compose for configuration changes like switching to LANDSCAPE/PORTRAIT mode. When I set the orientation to Landscape/Portrait, I see ...
1
vote
0
answers
77
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:...
0
votes
0
answers
251
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 ...
0
votes
1
answer
116
views
How to disable pop-ups in immersive mode when using Gradle-managed devices?
I want to start using Gradle-managed devices to test my Android app with the following configuration in my build.gradle file.
testOptions {
animationsDisabled = true
managedDevices {
...
0
votes
1
answer
316
views
Instrumentation tests can't find node tagged with string for test in Android
I'm trying to test a composable using .testTag that sits at the leaf level of the tree given the Composables call structure. The code is in the style of:
Top level Composable
@Composable
fun ...
1
vote
0
answers
25
views
Can't run Retrofit with MockWebServer using TestScope Jetpack Compose
when i try to call frankfurterApi.convert with test scope, the test instantly gets terminated(println("here2") doesn't get called), but with runBlocking everything works good, just like with ...
0
votes
0
answers
183
views
Appium image comparison with multiple result
I'm trying to make a image comparison with appium images plugin. The thing is that I now that the partial image I'm checking with the actual device screenshot should have multiple coincidences. As far ...
0
votes
0
answers
683
views
Compose UI test + coroutines issues
I'm setting up an androidTest to run a click test to make sure the login flow is always working.
The test is done in terms of opening the screen, press login button, enter email/password and then the ...
0
votes
0
answers
91
views
Saving a file artefact from an Android test after a test run
I'm debugging a video encoder app and need to check the produced file on my laptop, not in the emulator. Currently, I'm saving the resulting file to the temporary folder on the Android device, then I ...
0
votes
1
answer
50
views
Realm test fails despite successful saving in Android (Kotlin)
I'm testing a Realm database in an Android app using Kotlin coroutines. I have a ConnectionsRepository with an isEmpty() method, and I'm writing a unit test that asserts behavior before and after ...
1
vote
1
answer
46
views
Espresso does not match the found intents
I tried to mock the following using Matcher<Intent> on Android Espresso:
Intent { act=android.intent.action.CHOOSER (has extras) } handling packages:[[android, com.android.systemui]], extras:
[...
0
votes
1
answer
169
views
Android Gradle Managed Device Test Fails Need to Read WindowHierarchy
I want to dump the window hierarchy and read from the gradle managed device the file but I keep getting File issues with writing it. It should output it to the directory app/build/outputs/...
1
vote
1
answer
134
views
What is the difference between AndroidJUnit4::class and AndroidJUnit4ClassRunner::class?
I am a newbie to android testing and I have observer both of these classes being suggested when I declare a class with @RunWith() annotation. I searched for more documentation but there does not seem ...
2
votes
0
answers
151
views
How to use android-reporting plugin with Kotlin DSL and Version Catalog?
Following this documentation to get multi-module test reports for instrumented tests in a single HTML page, how to use it when using Kotlin DSL with Version Catalog?
So far none of these approach work
...
0
votes
0
answers
737
views
anndroid test fail java.lang.RuntimeException: Unable to get provider androidx.startup.InitializationProvider
I'm trying to run android tests from the terminal(gradlew connectedAndroidTest), all tests run and pass successfully, but at the end of the i'm filing with an errorTest run failed to complete. ...
0
votes
1
answer
79
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 ...