Understanding of building software with a certain quality, that fulfills the means of test-ability and a high automation level.
The usual development cycle followsdevelopment of a featuredeployment to devicemanual testingfix of wrong implementationdeployment to device and so on…So how do you automatize such an inelegant mobile development process? How can you reduce your manual testing effort? Well, you can start doing what every software developer should do: Start writing tests.In this blog post I am going to explain, how you can use the Espresso Testing Framework in your Android application development and how it helps to reduce the overhead of manual testing.Espresso is a testing tool released by Google to help developers write reliable and automated UI tests. Compared to other Android user interface (UI) testing tools, Espresso provides synchronization of test actions with the UI. This means that Espresso knows when the UI thread of an application is idle, and will run test code at the appropriate times.
Previously, other workarounds were needed (e.g. sleeping for a certain amount of time before executing the next instruction). Since the release of Espresso v2.0, the testing framework is available as part of the Android Support Repository and now supports JUnit4.To set up Espresso for your android project you can follow instructions from their official page.Espresso Setting Up GuidelinesEspresso has a small, predictable, easy to learn API and it is built on top of the Android instrumentation framework.This framework allows white-box tests written in Java, using the Hamcrest matchers to simplify the reading and writing of test scripts.Pros:Open source framework for native Android appsEasy to set up and easily extendableProvides a rich debugging information when a failure happensIs supported on all API versionsCons:Very small, not very active communityLack of documentationTest RuleAndroid Studio creates tests by default in src/androidTest/java/com.example.package/Example JUnit4 test using Rules: