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
0
votes
0 answers

UiDevice class missing from UIAutomator 2.1.2

I found that "upgrading" my reference to UIAutomator in build.gradle to 2.1.2 broke any references I had to the UiDevice class. In fact, a lot seems to have changed but I'm finding nothing explaining it. Can anyone shed some light on what is…
JoeHz
  • 2,136
  • 1
  • 18
  • 29
0
votes
2 answers

Empty test suite error : Writing Instrumentation test cases for android

I am following the steps exactly as mentioned here to create instrumentation unit test cases. This is my Test class in the androidTest->Java->com.mypackage.name package @RunWith(AndroidJUnit4.class) @SmallTest public class Test { private…
Ashwin
  • 12,691
  • 31
  • 118
  • 190
0
votes
1 answer

Instrumentation Tests: define a test as mandatory for the following

I have an Android instrumentation test which tests my ServerApi and multiple other instrumentations which test e.g. my Activities. One of the reasons the ServerApi test can fail is (sadly) a broken wifi. In this case, my whole test suite takes ages…
PhilLab
  • 4,777
  • 1
  • 25
  • 77
0
votes
1 answer

How to detect if my Android application has been started using AndroidJUnitRunner?

I need to detect at runtime from the code if the application is run using an Instrumented Test. I'm looking for a solution that works without knowing the Test class.
0
votes
1 answer

Instrumentation testing an Android activity with intents in isolation

I am attempting to instrumentation test an Activity in isolation however I'm running into issues because part of the testing requires that I verify that the Activity under test launches another Activity via an Intent. What I'm looking for is some…
0
votes
0 answers

How to configure androidTest package in project?

I am working with an Android project where the androidTest package has been deleted from src and there is no package suffixed with '(androidTest)' in the project structure. I am trying to create an androidTest package as I need to run…
oldsport76
  • 387
  • 2
  • 10
0
votes
2 answers

Alternative for SystemClock.sleep in Android Espresso

I am writing my test cases for my app however have come into some minor problems. Many of my test cases have SystemClock.Sleep calls in them, in order for the view to load all the data and display it on the screen. However the number of sleeps to do…
Billy Boyo
  • 819
  • 2
  • 12
  • 22
0
votes
1 answer

Android instrumented test infinitely running

I've written up some instrumented tests, and the assertions are passing - however regardless of what configuration they are run in, the run never terminates/ends - I have to manually terminate the run - which is not optimal for a CI setup. I have…
0
votes
0 answers

Android Rest API Automation Test

I have done API testing as sample application as shown in bellow code with using wiremock. but i have get numberFormat exception and invalide int as shown in bellow this error please give me any suggestion @RunWith(AndroidJUnit4.class) public…
0
votes
1 answer

How to check that item is selected in AlertDialog with Espresso test framework

So, I have an AlertDialog with a list of selectable items. One of them is always selected. In the instrumentation tests, I want to open the dialogue and check that an item with a specific text is selected. I've tried using to no avail the following…
0
votes
1 answer

Intrumented Test related to PendingIntent.getBroadcast()

I am trying to instrumented test my alarm module. In the instrumented test, I try to use and set an alarm with the system Alarm service. AlarmManager alarmMgr = (AlarmManager) …
0
votes
1 answer

Error when generating code coverage report for androidTest instrumented testcases with dagger

I want to run createDebugCoverageReport gradle task.But after run task is failing and giving below error. java.lang.NoClassDefFoundError: dagger.shaded.auto.common.BasicAnnotationProcessor at java.lang.Class.classForName(Native Method) at…
0
votes
1 answer

Android UiAutomator test case jar file is not working

I have been trying to write some instrumental test case of android code using UiAutomator tool. This test cases can be run via android studio without any problem. But now i want to install this test cases into device as a jar file and need to run…
0
votes
1 answer

How to test second activity started in instrumentation test in MVP?

I am new to MVP in android. My question is related to Instrumentation test in android. I am calling second_activity() in main_activity() using intent. So how can I test whether second_activity is called or not in instrumentation test using…
0
votes
1 answer

Cannot resolve symbol 'AndroidJUnit4' for Android instrumentation test

This error has been faced a lot before and asked here. According to the answers, i had to put my instrumentation tests under androidTest folder. So after that, in my case, am still unable to import the AndroidJunit4 class and the pop-up suggestion…
GB11
  • 175
  • 1
  • 18