Questions tagged [android-espresso]

Espresso is a library which is used to write Android UI tests. It is also known as Google's Testing Tools For Android

Also called android-test-kit, Espresso helps to create faster UI tests for Android.

The core API is small, predictable, and easy to learn and yet remains open for customization. Espresso tests state expectations, interactions, and assertions clearly without the distraction of boilerplate content, custom infrastructure, or messy implementation details getting in the way.

Espresso tests run optimally fast! Leave your waits, syncs, sleeps, and polls behind and let Espresso gracefully manipulate and assert on the application UI when it is at rest. Enjoy writing and executing your tests today - try a shot of Espresso!

Useful links

3335 questions
18
votes
5 answers

How to test Android UI using IdlingResource when using Retrofit network requests

I am writing integration tests that perform actions in the UI which start network calls using Retrofit. I know I need to implement a CountingIdlingResource, but I want to do it the correct way (and not reinvent the wheel if it has already been…
Austyn Mahoney
  • 11,398
  • 8
  • 64
  • 85
17
votes
4 answers

How to Access Activity from ActivityScenarioRule

I am using ActivityScenarioRule for Espresso UI Testing and I wanted to get access to the method getStringArray(), calling which requires the Activity . So, is there any way to retrieve the Activity by the ActivityScenarioRule , maybe something…
Satyam Bansal
  • 363
  • 1
  • 4
  • 11
17
votes
8 answers

Android Studio 3.6 Test framework quit unexpectedly, Crash of orchestrator

I'm having hard time running instrumented tests in Android Studio. When I try try to run multiple test cases, "Test framework quit unexpectedly" shows up: ... and all the tests continue to run in the emulator, but Android Studio is not getting the…
17
votes
2 answers

Testing EditText errors with Espresso on Android

I want to test if an EditText field has an error (set with editText.setError("Cannot be blank!")). I've created an Espresso test case with the new AndroidStudio 2.2 feature, to record Espresso tests. So the code is pretty much auto-generated. But…
Michael Woywod
  • 448
  • 4
  • 12
17
votes
1 answer

How to test a specific Activity with Espresso?

I have only just started with testing in Android and this seems very basic but after much googling I still can't find the answer anywhere. In my Android app the first activity which is displayed is a login screen, followed by a home screen with…
Adam
  • 2,167
  • 5
  • 19
  • 33
17
votes
2 answers

Stopping Android studio shell process wont stop tests

I am executing a some gradle tasks from a shell script, and am finding that i am unable to kill the process: I click stop process like shown in the image, but it doesnt stop the Espresso UI tests from executing on the emulator. the shell script is…
1ak31sha
  • 501
  • 7
  • 18
17
votes
3 answers

How to use Espresso UI Testing for React Native?

I'm trying to make some UI Testing with Espresso on my React Native Android application to use Screengrab by Fastlane. I have followed this tutorial to integrate React Native in an existing app to be able to write a test. But when I started writing…
17
votes
7 answers

Wait for view pager animations with espresso?

Trying to do some tests with a ViewPager. I want to swipe between tabs, and I don't want to continue until the swipe is complete. But there doesn't appear to be a way to turn off the animation for the view pager (all animations under the developer…
Mark
  • 2,362
  • 18
  • 34
17
votes
4 answers

How to disable animations in code when running Espresso tests

Has anybody managed to disable animations through code when running Espresso tests? I've been trying to follow the instructions in this webpage (linked to from here): https://code.google.com/p/android-test-kit/wiki/DisablingAnimations…
17
votes
1 answer

How to use Espresso Idling Resource

The scenario is when the user click on the "Download" button, the data (a music/an image etc.) starts being downloaded from the internet. When the download is finished, the button changes it label text to "Open". The user then click on that "Open"…
philomath
  • 2,209
  • 6
  • 33
  • 45
17
votes
2 answers

How to provide mock data when testing with Espresso

We have a very large Android application with no tests. We're suffering the typical quality/too long manual regression testing cycles problem. As a server side developer, who is new to Android, I want to introduce developer tests. I can see how to…
FinalFive
  • 1,465
  • 2
  • 18
  • 33
17
votes
4 answers

Getting Dagger to inject mock objects when doing Espresso functional testing for Android

I've recently gone whole-hog with Dagger because the concept of DI makes complete sense. One of the nicer "by-products" of DI (as Jake Wharton put in one of his presentations) is easier testability. So now I'm basically using Espresso to do some…
16
votes
3 answers

Android UI tests with Espresso + MockK crash with SIGSEGV on emulators, fine on physical devices

I have just started using MockK to mock all the Repositories / Services logic in an MVP-based app for UI tests. I have some UI tests running a login activity where the Espresso inputs logins and passwords and using MockK I can fake various situation…
Mackovich
  • 3,319
  • 6
  • 35
  • 73
16
votes
7 answers

Mockito 2 for Android Instrumentation test : Could not initialize plugin: interface org.mockito.plugins.MockMaker

I'm using Mockito 2 and Espresso for Unit tests, and met a problem trying to use Mockito 2 in Instrumentation test. While running the test, I'm getting this error java.lang.IllegalStateException: Could not initialize plugin: interface…
Arshak92
  • 634
  • 3
  • 10
  • 24
16
votes
1 answer

Espresso. Error performing 'load adapter data'

I have a ListView, which shows data from a database. db = new DB(this); db.open(); String[] from = new String[]{DB.COLUMN_FIRSTNAME, DB.COLUMN_LASTNAME}; int[] to = new int[]{android.R.id.text1, android.R.id.text2}; …
pligosv
  • 653
  • 1
  • 7
  • 19