Questions tagged [android-instrumentation]

Base class for implementing application instrumentation code.

Base class for implementing application instrumentation code.

When running with instrumentation turned on, this class will be instantiated for you before any of the application code, allowing you to monitor all of the interaction the system has with the application. An Instrumentation implementation is described to the system through an AndroidManifest.xml's <instrumentation> tag.

Reference: http://developer.android.com/reference/android/app/Instrumentation.html

526 questions
7
votes
2 answers

Getting "No compose views found in the app. Is your Activity resumed?"

I have a Composable that has a Text and Button. Text will show P if the current orientation is portrait, and L otherwise. Clicking on the Button will change the orientation to landscape, (So after that, it should change the text from P to L) Here's…
7
votes
2 answers

Disable Firebase initialization when running instrumentation tests for modules

I have a multi module project. I want to be able to run the instrumentation tests i'm writing for these modules separately. I am continually running into the below error when I run the tests and initialize the activity. Default FirebaseApp is not…
Kyle
  • 1,430
  • 1
  • 11
  • 34
7
votes
2 answers

Cannot start an android emulator in gitlab-ci

I am trying to setup instrumentation tests in gitlab-ci. However the job is stuck at a point with following message: PANIC: Missing emulator engine program for 'x86' CPU. Here is the ci configuration that I am using. The pipeline build runs…
Angad Singh
  • 1,032
  • 1
  • 17
  • 36
7
votes
3 answers

No instrumentation runner found on device emulator-5556 for package my.project.android.debug

I am trying to run Detox test on the emulator. When I run "detox test --configuration android.emu.debug -l verbose" it throwing error message as "No instrumentation runner found on device emulator-5556 for package my.project.android.debug at…
Neerajkumar
  • 300
  • 4
  • 19
7
votes
2 answers

Coverage for android tests using orchestrator

I am working on a project where in we are trying to use the ANDROID TEST ORCHESTRATOR for it's obvious benefits of isolating crashes. But while executing the test suite, it appears to me that as the orchestrator initiates a new process for every…
7
votes
0 answers

Change BuildConfig for Instrumentation Tests only

Is it possible to change the fields in a BuildConfig for Instrumentation Tests only? The current motivation behind this is that I want to point an app's urls to a different server (i.e. a local mock server) only for Instrumentation Tests. These urls…
dav_i
  • 27,509
  • 17
  • 104
  • 136
7
votes
2 answers

connectedAndroidTest fails with "no connected devices" but am instrument works

I'm setting up a Jenkins node (on Mac OS X) running instrumentation tests for my Android app. My Jenkins project starts an Android emulator and runs the Gradle task :app:connectedAndroidTest. But the task has always been unstable, sometimes being…
ris8_allo_zen0
  • 1,537
  • 1
  • 15
  • 35
7
votes
3 answers

No error still Android Studio says "no tests were found"

I am trying to write an instrumentation test for my MainActivity. I followed the answers given here. Still Android Studio cannot find any tests. I have the class ApplicationTest.java in the androidTest folder. Here's the contents of the…
Monica
  • 389
  • 1
  • 7
  • 19
7
votes
6 answers

android.support.test.espresso.NoActivityResumedException: No activities in stage RESUMED

I'm trying to write test cases for my activities. I have several activities and there is no issue for one of them while I'm getting following error when I try to run tests over other ActivityTest…
Hesam
  • 52,260
  • 74
  • 224
  • 365
7
votes
2 answers

java.lang.AbstractMethodError when spy the LinkedList in Android

I want to spy the Linkedlist in android. List list = new LinkedList(); List spyData = Mockito.spy(list); spyData.add("xxxx"); However, the exception occured. java.lang.AbstractMethodError: abstract method "boolean…
alec.tu
  • 1,647
  • 2
  • 20
  • 41
7
votes
2 answers

Ui Automator 2.0 project in Android Studio

I want to set up a project in Android Studio. However, I don't want an Android App, just the test project. Following the lastest release of UiAutomator, I was trying to set a class extending ActivityInstrumentationTestCase2 and start my tests from…
6
votes
0 answers

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:$mockitoVersion" I have added a file…
Suraj Vaishnav
  • 7,777
  • 4
  • 43
  • 46
6
votes
1 answer

Exclude android Instrumentation tests while generating Jacoco report

I have multiple modules in Android application. I need to automate code coverage report in the CI/CD pipeline where it doesn’t have physical/virtual android device and not possible to attach a device. Integrated Jacoco from -…
Vamsi
  • 5,853
  • 6
  • 29
  • 36
6
votes
2 answers

Hilt Instrumentation test with Workmanager not working

When I try to run an ActivityScenario in my application that contains a WorkManager I get the following error on start: java.lang.IllegalStateException: WorkManager is not initialized properly. You have explicitly disabled WorkManagerInitializer in…
6
votes
1 answer

How can I test Android WorkManager with setRequiredNetworkType(NetworkType.CONNECTED) constraint?

I am trying to write Android instrumentation tests for a class that contains WorkManager WorkRequests. For a long time I was stuck at the point where I could see the workers being enqueued but they never got executed. After some time and trial and…