Questions tagged [instrumented-test]

Framework for Android instrumented testing to interact with UI components.

116 questions
0
votes
0 answers

Get a view during an espresso test

I am trying to check what paint flags a view currently has during an instrumented test. I am trying to do this by accessing the view during the test and then looking at its paint flags. I have tried val view = onView(withText("kitchen")) but this…
Rory Danes
  • 163
  • 1
  • 6
  • 14
0
votes
1 answer

How to mock an SQLiteOpenHelper

I am trying to mock an SQLiteOpenHelper class in instrumented tests so whenever any fragment tries to get information from the database it returns a generic result. However, I keep getting an error…
T. Green
  • 323
  • 10
  • 20
0
votes
1 answer

Running an instrumented test in Android Studio without simulating user actions

I have written some code that manipulates MotionEvent instances, and want to write a unit test for it. The unit test needs to validate my manipulations only; it does not need to simulate any user actions. I understand it needs to be an instrumented…
0
votes
1 answer

Testing WorkManager - RUNNING instead of ENQUEUED

I am following this example, but my test fails, since workInfo.state is RUNNING instead of ENQUEUED. Does anyone know what might be the issue? Please let me know if I should provide more code/context.
0
votes
1 answer

Android Getting R8 error: Already has a mapping when trying to run UI tests with minified build

I want to be able to run UI tests on a minified build. However when I run ./gradlew connectedDebugAndroidTest I get this error: > Task :app:minifyDebugAndroidTestWithR8 R8: 'void…
odiggity
  • 1,496
  • 16
  • 29
0
votes
1 answer

testing androidx.fragment lifecycle by stopping and resuming with FragmentScenario, onCreateView() called twice but this bug is already fixed in 1.3.1

I'm writing instrumented tests for my app using androidx.fragment:fragment-testing. One of test cases is to check if all underlying logic behaves correctly when Fragment is stopped and resumed, to simulate app being minimized (home button) and…
0
votes
1 answer

How to set an order in instrumented test over the Test Class?

I'd like to set an order over the Test Class. @RunWith(AndroidJUnit4::class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) class ATest { @Test fun test0000() @Test fun…
Bee
  • 23
  • 2
0
votes
1 answer

How to implement android espresso tests in the bitbucket pipeline?

I am implementing CI in my android project, but I am not able to put my Android espresso tests to run in the pipeline. Can anybody help me?
0
votes
1 answer

How to load all test resources without using names in Android?

In my androidTest/resources directory I have a few hundreds of images. I want to read all of them in a loop and test against specific function. I don't want to use their names, as often I don't know them. Is there any possibility to load by regex or…
dragon7
  • 1,057
  • 9
  • 23
0
votes
1 answer

Espresso: avoid AmbiguousViewMatcherException by specifying the parent view

onView(withId(R.id.feeding_name)).check(matches(isDisplayed())); causes AmbiguousViewMatcherException. Due to multiple fragments on the screen the id "feeding_name" matches multiple views. I am wondering, if there is any way to specify the parent of…
0
votes
1 answer

Which is a better way to access Context in instrumented unit tests?

Which of the following is more recommended to access Context in instrumented unit tests: using ApplicationProvider or InstrumentationRegistry? val context: Context = ApplicationProvider.getApplicationContext() import…
0
votes
1 answer

Android Studio Firebase Test Lab Infrastructure Failure: Internal error during validation

I am facing issues running Android Instrumented Tests on Firebase Test Lab. I am doing it for educational purposes. Is there something wrong with my configuration? I am using the Spark Plan and have billing enabled on my project. Testing started at…
0
votes
0 answers

Firebase Test Labs Android Instrumented Test. How can I run each device sequentially. Not simultaneously

Our app only allows 1 user to be actively logged in at any given time. If the same user attempts to log into another device, that user will be logged out of the previous device. Is it possible to have Firebase Test Labs Instrumented Test run each…
TimH
  • 60
  • 8
0
votes
0 answers

While running Instrumentation Test on 2 Emulators - connectedProStagingDebugAndroidTest Failed - INSTALL_FAILED_INVALID_APK -/base.apk code is missing

I tried to run Instrumentation test on 2 Emulators, using 2 different test suites with below shell script on CI machine which is using Jenkins to run the job. startTest(){ ./gradlew installProStagingDebug ./gradlew…
0
votes
1 answer

More than one file was found with OS independent path 'org/apache/commons/csv/QuoteMode.java'

As far as I have read the other link regarding similar issues like this, there is always the issue of 2 libraries conflicting, I think that's the case with me too but can anyone tell me which library is causing the conflict or what is the issue and…