Questions tagged [android-instrumentation]
Base class for implementing application instrumentation code.
519
questions
0
votes
0
answers
16
views
Accessing Storage From Orchestrated Espresso Test
I have a test apk being built, and I'd like that test apk to be able to read some configuration values from an external file, rather than having to compile that configuration into the apk file.
I have ...
0
votes
1
answer
14
views
How to write Android instrumented UI test for native Camera activity
I have a MainActivity with a button that will launch the native Camera Activity via Intent(MediaStore.ACTION_IMAGE_CAPTURE). I would like to write an Android UI test that will:
Confirm we are on the ...
0
votes
0
answers
7
views
How to use Android Studio Database Inspector in Instrumentation Tests?
I am trying to debug an SQL table in Android Studio however nothing shows in the App Inspection tool window.
I am using an Instrumentation Tests. I would expect to be able to see my_table in the tool ...
0
votes
0
answers
13
views
How can I return custom return values to the calling gradle task, when running instrumentation unit tests on Android
The scenario
I am running a JUnit test suite, which creates various result files during the test run.
These result files are then stored into a zip file to be returned to the development machine.
My ...
0
votes
0
answers
21
views
Configure Android instrumented tests to prevent them from first uninstalling the existing APK, and to re-use existing APK instead?
Is it possible to configure Android instrumented tests to prevent them from uninstalling the existing APK, and to re-use that APK instead?
Each time I run an instrumented test in Android Studio(...
1
vote
0
answers
28
views
How can I create an Android end-to-end test for a specific user flow?
The aim is to create end-to-end tests for a native Android app, that allows us to validate the "happy path" and alleviate our QA burden of manually carrying out these tasks.
In the project, ...
1
vote
0
answers
5
views
JUnit 4 in Android starts and process is quickly killed and no exceptions too
**Below is the class. As soon as the SOUT prints within a second it completes. Tested in debug mode and same.
Logcat shows that process is ended. No Exception is observed. Code compiles without any ...
0
votes
0
answers
7
views
Is there a callback for AWS Devicefarm scheduleRun
I am running my Android Instrumentation tests with AWS Devicefarm but I want to know if there is a way to provide the ScheduleRun with a callback for status of the tests
0
votes
0
answers
24
views
Why does Macrobenchmark lib returns an outlier result in the first iteration?
I am using Macrobenchmark library:
@Test
fun benchmarkStartup() = benchmarkRule.measureRepeated(
packageName = TARGET_PACKAGE,
metrics = listOf(StartupTimingMetric()),
...
0
votes
0
answers
24
views
Jacoco Coverage Report for Instrumented Tests Include only Tested Code
Instrumented tests instantiate the app.
Generating a Jacoco coverage report includes then also code that was called during the app initialization even if it was not actually called during any tests.
...
0
votes
0
answers
29
views
Espresso not invoking click listener in viewholder item?
I have a recyclerview adapter which takes an onclick listener as a constructor parameter like so
Adapter{}.
The clicklistener is then passed to the ViewHolder constructor in onCreateViewHolder. In the ...
0
votes
0
answers
14
views
Consuming a webservice running in Android app in a Instrumentationtest
I'm trying to figure out how to test a rest api and websocket running inside an android application with a AndroidInstrumentation test.
Service in android is running on 0.0.0.0:5053 and is working ...
0
votes
1
answer
64
views
Instrumented test is stuck on "Connected to process"
When I try to run the ExampleInstrumentedTest on my Android Studio project, it builds fine, installs the test and then it is stuck on "Connected to process ####..." and no test results are ...
0
votes
1
answer
52
views
Gradle failed to resolve: com.squareup.spoon:spoon-client:2.0.0-SNAPSHOT
I'm trying to use the Spoon plugin for my Instrumentation Tests, but I am unable to proceed with a Gradle error unable to resolve dependency Failed to resolve: com.squareup.spoon:spoon-client:2.0.0-...
1
vote
0
answers
79
views
Android Instrumentation Orchestrator's `clearPackageData` does not clear data
I have defined these into my build.gradle, to enable Orchestrator in my Android Instrumented tests:
defaultConfig {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
...
0
votes
0
answers
14
views
Android Instrumented Testing Launch Success but doesn't run any test case
I get problem with my instrumented testing case, where class test doesn't want launching my activity. I was looking foward and many solution have added this section
defaultConfig {
...
2
votes
1
answer
86
views
Instrumentation tests don't ask for user permissions in Firebase Test Lab
When I run instrumentation tests in Firebase Test Lab, the system dialogs asking the user to grant permissions don't come up, as if they were approved without the need for user action. For example ...
0
votes
1
answer
212
views
Android instrumentation does not start on a second device
Since some time, when I run an instrumentation test on a device (emulator) and try to start another test on a second device in parallel, I get the following exception:
FAILURE: Build failed with an ...
1
vote
0
answers
23
views
Android Billing test purchase id deprecated?
I used test puchase ids such as "android.test.purchased" for my instrumentation tests. When I last run these tests they failed on every device, as the dialog does not show any "Purchase ...
0
votes
0
answers
48
views
Determine selected adb Device, when running app/instrumentation tests via Android Studio
The scenario
I currently have the task to write unit tests for Android apps, that run on the development machine and on the test device itself (instrumentation).
Within or after the unit tests or (...
2
votes
2
answers
194
views
How to get the current webview object in Android?
I am using Datadog to track user activity in my app. Now I need to instrument webviews. After initializing datadog's sdk , its documentation says that I have to call the following code snippet:
...
0
votes
1
answer
97
views
Instantiate Hilt Worker for Instrumentation Testing?
I am having problem trying to initialize my WorkerGetData class for instrumentation testing. I have done the following:
removed the default work initializer in manifest file.
added configuration ...
0
votes
0
answers
68
views
UIdevice.dumpWindowHierarchy() not working for WebView changes
I am using method dumpWindowHierarchy() to get the Hierarchy dump for my automation tests. It is working fine and giving me the hierarchy for the web-view window but the problem is when there is ...
1
vote
1
answer
606
views
Kotlin Coroutines Test fails: NoSuchMethodError: No virtual metod 'find'
I am in the process of migrating to kotlin coroutines test 1.6.x
This is a very basic test that fails:
import kotlinx.coroutines.test.runTest
import org.junit.Test
class HouseDaoTest {
@Test
...
0
votes
1
answer
142
views
How to build Test APK for Firebase Test Lab
Firebase Test Lab asks to upload two APKs:
App APK
Test APK
How to build test APK?
0
votes
0
answers
33
views
How to define instrumentation args in build.gradle and pass it to Instrumentation Test?
I use the following command to run my test from Command Line:
./gradlew :myModule:connectedDebugAndroidTest
-Pandroid.testInstrumentationRunnerArguments.class=com.mypackage.someTestClass
-Pandroid....
1
vote
0
answers
333
views
frida error `TypeError: cannot write property 'implementation' of undefined`
I am trying to inject the below script using frida
function main() {
Java.perform(function () {
let fhs = Java.use("com.tencent.mm.protocal.protobuf.fhs");
fhs.da.implementation = ...
0
votes
0
answers
307
views
How to wait for next screen testTag in Jetpack Compose?
I have written UI test to test a journey of a feature of an app. When I navigate to next screen but android can't find any tag as it is building the UI.
So, for this I had to use Thread.sleep(...
1
vote
0
answers
151
views
Android Instrumentation test (launch another activity B after button click)
I'm trying to perform a simple UI test case: I have 2 activities (A-B).
A has a fragment immediately loaded from the xml file of the activity, all the code is hosted in the fragment, so basically ...
0
votes
0
answers
54
views
How to test an extended View class in Android Studio
I am fairly new to Java and Android development. I would like to conduct an instrumentation test on Android Studio for testing a UI.
I have PianoView class as extended class of View and this class is ...
0
votes
0
answers
51
views
Instrumentation tests fail only in release mode: Unable to resolve activity for: Intent
I have some instrumentation tests and a CI that has a firebase test lab job.
I was running all tests in debug (default and standard behavior) and they are all passing successfully (both locally and ...
1
vote
1
answer
226
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 ...
0
votes
0
answers
28
views
Android Instrumentation Tests when ran are giving error "EarlySingletonComponentCreatorImpl is not abstract"
When running instrumentation tests on Android Studio , seeing below error.
EarlySingletonComponentCreatorImpl is not abstract and does not override abstract method create() in ...
0
votes
1
answer
109
views
Android Espresso not able to test fragement
I am trying to launch a fragment as below
private lateinit var homeFragmentScenario: FragmentScenario<HomeFragment>
@MockK
lateinit var mockPool: UserPool
@Before
fun setUp() {
...
0
votes
0
answers
28
views
Disable System `AlertDialog` in android instrumented tests
Is there any way to bypass or disable android system AlartDialog`s which require a user interaction (Allow, Deny) for android instrumented tests?
Context:
I am testing a Bluetooth application with ...
0
votes
0
answers
175
views
How to run android microbenchmark in single module project?
I'm trying to run android microbenchmark using single module project. I've just placed SimpleBenchmark into app/src/androidTest/java/com/example/benchmarks/SimpleBenchmark.kt file:
@RunWith(...
0
votes
1
answer
67
views
AndroidJUnitRunner cannot find extra class com.squareup.leakcanary.FailTestOnLeakRunListener
I am trying to run leak canary along with my Android Instrumentation tests. I followed the LeakCanary documentation https://square.github.io/leakcanary/upgrading-to-leakcanary-2.0/#running-leakcanary-...
0
votes
0
answers
9
views
Instrumented Test throws AssertionError but succeeds anyways
I have the following simple instrumented ViewModel test:
@RunWith(AndroidJUnit4::class)
class LoginViewModelInstrumentedTest {
@Test
fun loginViewModel_getOrAwait_success() {
val ...
0
votes
0
answers
27
views
Android test startAcitivityForResult and onActivityResult
I have two activities; ActivityA and ActivityB. I want to test the following interaction (Video here):
Start at ActivityA
Tap on the "Go To ActivityB" button
Test if ActivityB is started ...
2
votes
0
answers
133
views
Is there an Android Test Orchestrator that restarts process for each class but not for each test?
I know of two ways to run Android Instrumented tests:
Default - no orchestartor. The same app process lives throughout the lifetime of the test suite
With AndroidX Test Orchestator. The app is killed ...
4
votes
0
answers
402
views
Android instrumentation tests throwing SecurityException
I'm developing a small set of instrumented tests using JUnit and Espresso to automate the testing process of my activities and fragments, but I'm having some crashes in some devices.
The test suite ...
0
votes
0
answers
21
views
How do you write an Androidx Instrumentation that runs multiple Instrumentations?
I want to write an Androidx test that starts an Application, waits for it to crash, and then starts it again.
As I understand it, by default, AndroidX tests run on a instrumentation, and when one test ...
5
votes
0
answers
509
views
Mockito not working in instrumentation test
I am getting error when I use mockito in instrumentation.
This is the library I am using:
def mockitoVersion = "3.10.0"
androidTestImplementation "org.mockito:mockito-android:$...
0
votes
0
answers
15
views
How to get Java script from culebra test?
I installed Python 3.10 and AndroidViewClient, launched Culebra GUI v21.7.0 successfully, but I don't know how to get java script after running a test with Culebra, I am not sure if the documentation ...
0
votes
0
answers
76
views
How to instrumentation test activity going into background (STOPPED) then foreground (RESUMED)?
I'm trying to do an instrumentation test to test behaviour when the app has been backgrounded then brought back to the foreground.
I thought it would be easy to use ActivityScenario.moveToState(), ...
1
vote
0
answers
221
views
DetoxRuntimeError: No instrumentation runner found on device null for package
I have been trying to understand this error but cannot pinpoint the reason behind No instrumentation runner. The moment I run the command, it fails. I am also unable to use --loglevel trace to get the ...
0
votes
0
answers
241
views
Run instrumentation tests on remote emulator fail with TimeoutCancellationException
I'm trying to run instrumentation tests on an emulator running on a remote machine. I connect via an SSH Tunnel / adb connect to localhost.
When I run the instrumentation tests via Android Studio ...
0
votes
1
answer
284
views
Android Studio - ActivityInstrumentationTestCase2 not found?
I am trying to unit test my MainActivty. My project cannot find ActivityInstrumentationTestCase2 and android.test package. I changed the target SDK to 27 to see if that resolves that problem but to no ...
1
vote
0
answers
75
views
Whitespace in custom args on Android instrument test run
I have this instrumented test suite in Android, that I would like to pass some custom arguments to. I've been using this format, as stated in the official documentation:
adb shell am instrument -w -e ...
0
votes
1
answer
225
views
Flutter: Android instrumentation test - how to provide no sound null safety argument to gradlew command
While working with integration tests for a flutter app (which is currently in migration stage to sound null safety), the gradlew app:assembleDebug -Ptarget=<path_to_test>.dart command failed ...