What is Espresso in the first place?
USA
Please select your cookie preferences before getting in touch
Thank you for reaching out to Sigma Software!
Please fill the form below. Our team will contact you shortly.
Sigma Software has offices in multiple locations in Europe, Northern America, Asia and Latin America.
USA
Sweden
Germany
Canada
Israel
Singapore
UAE
Australia
Austria
Ukraine
Poland
Argentina
Brazil
Bulgaria
Colombia
Czech Republic
Hungary
Mexico
Portugal
Let's discuss Espresso for Android. What is its use for a test automation engineer? What drawbacks does the tool have?
It is a tool for testing the UI of Android applications developed and supported by Google. Although this tool is positioned more as an Android developer’s tool for white/grey-box testing, it can be quite efficiently used by test automation engineers for grey/black-box as well.
It can shift UI tests from their sad place at the top of the testing pyramid a bit closer to its base – as most UI tests are slow and costly (see https://martinfowler.com/bliki/TestPyramid.html).
Visual comparison of different tools according to their speed and reliability looks like this (the values are taken from [3]):
Note to the diagram: “Fallibility = 1 for UIAutomator does not mean that 100% tests fail with it, instead, it means that this tool with the highest number of fails was taken for 100%. If we take the absolute ratio of failed tests to launched tests, for UIAutomator it is 7.58%, and for Espresso it is 0.06%. These 7.85% do not look like a huge number, but if the number of tests is, say, 500, about 40 tests will fail, and dealing with all 40 will take time.
Below is a screenshot of Android Studio with Android Wear emulator open and calculator running. The Android Studio window shows the code that the recorder has generated for the simplest test case – “check that 1+2=3”.
After some refactoring the test will look as follows:
@Test
public void mainActivityTest2() {
onView(withId(R.id.digit_1)).perform(click());
onView(withId(R.id.op_add)).perform(click());
onView(withId(R.id.digit_2)).perform(click());
onView(withId(R.id.eq)).perform(click());
onView(allOf(Matchers.instanceOf(android.widget.EditText.class),
withText("3"))).check(matches(isDisplayed()));
If the task is to cover an Android application with automated UI tests, and you have access to the application source code – Espresso will be the most optimal tool due to its speed and reliability.
Yevgen is Senior Test Engineer / Test Automation Engineer who is persistently looking for more efficient ways for testing-related tasks automation.
In today’s data-driven world, the ability to process and analyze data in real-time is crucial for businesses to stay competitive. At Sigma Software, we always s...
Medical imaging plays a vital role in today’s healthcare by providing critical information about the inner workings of the body. Historically, this field has re...
ADHD is a neurodevelopmental disorder that affects many people around the world and this includes symptoms such as inattention combined with hyperactivity and i...