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
15
votes
3 answers

Espresso: How to use R.string resources of androidTest folder

I want to put data in xml file of androidTest/res/values/string.xml folder. I have created the file say test.xml with below contents. hello When i am…
15
votes
3 answers

Espresso does no record any intent if there are no buttons

I'm trying to write a test to verify intent launching with espresso, the problem is that intended() does not record any intent. I have this test @Test public void shoulddosomething(){ startActivity(); …
Borja
  • 1,318
  • 13
  • 18
15
votes
3 answers

No tests found in when testing with Espresso

I want to test my MainActivity in my Android application. So, I created a first test case which tests the functionality of a button. If the user clicks this particular button, a new Activity should open. Here is my…
user3475602
  • 1,217
  • 2
  • 21
  • 43
15
votes
1 answer

Android Espresso Ui Test verify label text of ActionPage

I am trying to test the text of an ActionPage using Espresso. However, when I run the Ui Automation Viewer I can see that the ActionPage is being shown as a View instead of an ActionView and it does not have a TextView. I have tried checking for the…
AlexIIP
  • 2,461
  • 5
  • 29
  • 44
15
votes
8 answers

Using Espresso to test drawable changes

I'm new to Espresso testing, but there doesn't seem like there's any way to test drawable changes. I have a tutorial that is an ImageView Drawable slideshow 'tucked into' a semi-transparent TextView. In my tests, I want to ensure that when the next…
nukeforum
  • 1,284
  • 3
  • 16
  • 38
15
votes
5 answers

Android Espresso performs longClick instead of click

onData(anything()).inAdapterView(withId(R.id.ScheduleOrderListViewListView)) .atPosition(0).perform(click()); perfoms 50% of the time a longtouch - is there are a good workaround?
PKAP
  • 705
  • 8
  • 20
15
votes
4 answers

How can I test setResult() in an Android Espresso test?

Is there any good way to test the result code and data in an Android Espresso test? I am using Espresso 2.0. Suppose I have an Activity called BarActivity.class, which upon performing some action, calls setResult(int resultCode, Intent data) with…
hiBrianLee
  • 1,847
  • 16
  • 19
15
votes
1 answer

Espresso freezing on view with looping animation

I have a view in which an element is animated with the following in an infinite loop:
siger
  • 3,112
  • 1
  • 27
  • 42
15
votes
3 answers

Write a test that clicks on views inside PopupWindow

I have a ListView inside a PopupWindow, and I want to click on the second item on the list. I've tried the following: // Open the popupwindow onView(withId(R.id.popupwindow_open)).perform(click()); And now that the popup window appears, I…
MisaMisa
  • 273
  • 3
  • 7
15
votes
1 answer

Espresso withText in TextView Doesn't match selected View

I'm running into a odd test failure with Espresso. The following is to test a TextView in a displayed Dialog. I get the following error: com.google.android.apps.common.testing.ui.espresso.base.DefaultFailureHandler$AssertionFailedWithCauseError:…
JCricket
  • 1,318
  • 2
  • 17
  • 34
15
votes
4 answers

testUI (Jenkins) using espresso

The app is passing the espresso tests locally, i mean directly to the devices and genymotion emulators. When I use Jenkins to built an app's image. The espresso test are not successful I get this error. JENKINS: java.lang.RuntimeException: Waited…
Alfaplus
  • 1,713
  • 2
  • 19
  • 29
15
votes
1 answer

How to automate upgrade testing for android

We have been using espresso for android automation, and that includes upgrade testing For upgrade testing, we need to perform 3 steps: Make some actions in the old version to prepare some data Upgrade to new version (cover install) Check the data…
Sugre
  • 851
  • 2
  • 9
  • 19
14
votes
2 answers

Espresso UI Test Cancelled with no error message

Here is the problem when I run my UI test. But the ExampleInstrumentedTest is working. This is my test file, I already comment out everything, leaving an empty function @RunWith(AndroidJUnit4ClassRunner::class) class ExploreFragmentTest { …
BabyishTank
  • 1,329
  • 3
  • 18
  • 39
14
votes
1 answer

Duplicate class warning when running Android instrumentation test

When creating a new empty activity project in Android Studio (3.5) and running the generated instrumentation test I get the following warnings: W/zygote: Found duplicate classes, falling back to extracting from APK :…
14
votes
1 answer

Test with consecutive calls to MockWebServer

I am writing test for an Activity which makes several consecutive calls to server. My MockWebServer mixes sequence of responses.e.g. When I make two consecutive requests request1 and request2 it sometimes returns request2's Json in response to…
Mag Hakobyan
  • 510
  • 1
  • 4
  • 17