Suyash Dubey | Posted on | 2 min Read

What is Expresso Framework?

Espresso is a testing framework used to write UI test cases. It automatically tests your actions with the UI of your application. The framework also ensures that your activity is started before the test run. It can be used to test across multiple applications. If used for testing outside application, you can perform only black box testing. as you cannot the classes inside the application.
 

Espresso has three components:

ViewMatchers: Allows to find the view in the current view library.
ViewActions: Allows to perform actions on the view
ViewAssertions: Allows to assert state of the view
 

Why Espresso?

It's fast: It is really important to run test cases at a fast pace as there can be many tests. UI test takes time and is costly and it is possible that you might not be able to run all the tests.
 
It's easy to setup: Setup process on local machines is easy and Android developers feel comfortable in the mobile SDK language which they use every day.
 
It's less flaky: Automated DevOps process required fast and reliable feedback. Test written in native tools is much less flaky. It gives more control over the application: It is white box testing, Espresso is inside the application, it has access to and knows how to use the code that actually runs the application for more thorough testing of each element.
 
You can use Espresso cheat sheet for quick reference as it contains most available instances of Matcher, ViewAction, and ViewAssertion.
 
espresso-cheatsheet

Source: https://developer.android.com/training/testing/espresso/cheat-sheet

 

Steps for running your Test scripts in Espresso using pCloudy:

Login over https://device.pcloudy.com with your registered Email ID & Password.
To schedule "Espresso" over pCloudy, follow the following steps-

  • Go to the "Automation" page.
  • Select the Automation tool as "Espresso".
  • Select "Instrumentation Type" based on the Test Scripts you've written.
  •  
    espresso 1
    Note: pCloudy provides support for Instrumentation Type(InstrumentationTestRunner, AndroidJUnitRunner, and AndroidXJUnitRunner) for Android.
     

  • Select the Application APK and Test APK that you must have uploaded in the MY APP/DATA section.
  • Select the single device execution time and assign a name to your test cycle.
  • In the next step, Click on "ADD" to add the device for testing and click on " Next".
  • Now you can select the devices by clicking on the "ADD" button. You can also use the device filter to make it easier to search for a device. Click on next once the devices are selected.
  •  
    E2

  • Click on "Schedule" to start the test.
  •  
    E3

  • Go to your email inbox and open pCloudy Automation Alert mail. Click on the given link “Click to view Report”.
  •  
    E4-

  • Now you have the result of your scheduled test automation.

 
E-5
 

Take a look at this GIF to understand the flow of actions taken to run the test cycle.
Webp.net-gifmaker (2)
Software developers tend to make mistakes as app development is a very complex process. This means that the app will contain bugs. Espresso helps us detect errors that may have been made in the development, ensuring the reliability of the client and his satisfaction with the application.

 
Related Articles:

  • Automated Testing Using Espresso
  • Run Espresso in pCloudy Using Gradle
  • Appium vs Espresso: The Most Popular Automation Testing Framework in 2019
  • Espresso with pCloudy.com
  • Basics of Appium Mobile Testing
  • Espresso with pCloudy

     
    Now, run your Espresso Scripts on hundreds of Mobile devices and build quality apps faster than ever.

    Several Mobile Automation Frameworks like Robotium, Calabash, Appium , KIF & uiautomator have been developed in recent years. Among a few popular ones, Espresso is one of them.

    You probably know, Espresso is a testing framework for Android apps. It is predominantly used by developers and testers for testing user interactions (UI) to ensure that users do not encounter crashes or unexpected results while using an app.

    There are several benefits of using Espresso, the primary ones are:

    • It automatically synchronises test actions with the UI of the app being tested. Meaning? To improve the reliability of tests, it detects when the main thread is idle and runs the test commands at the appropriate time.
    • This capability also relieves you from having to add any timing workarounds, such as a sleep period in your test code.
    • Espresso has an API that is small, easy to learn and built on top of the Android instrumentation framework.
    • It also supports testing activities outside the app like camera, browser and dialer etc which Appium does not support.

    However, when you have limited time and money it is a challenge to take full advantage of your Espresso scripts in improving the quality of your apps. Luckily, there are ways to overcome this.

    Conventionally, you would spend a huge amount of money to purchase several Android devices, and spend endless hours running your scripts independently on each device. Today, thankfully you don’t have to do this anymore, there is good news. With the help of a cloud-based testing platform like pCloudy.com, you can run your scripts on hundreds on real mobile devices in parallel.

    Yes, using pCloudy.com you can test your apps on any device of your choice and pay a just minimum price for the time you’ve used the device. You can not only save money, but you can also save your time by running your test scripts on multiple devices in parallel and get a detailed execution report.
     

    Here’s how you can use Espresso on pCloudy devices:

    pCloudy – On Boarding Document

     

    Thank you very much for opting pCloudy.

    We appreciate your business and welcome you to our long list of satisfied and much valued customers. Our success comes from the continuous faith in the excellence of our products and services, something we are committed to and would never sacrifice.

     

    Our customer service, especially in the after sales phase, guarantees the satisfaction of our clients. In line with this strategy, we ask you to share with us your feedback at any time, be it positive or negative. There is always room for improvement, so if we can serve you better in anyway, please do inform us.

     

    Introduction

     

    This document is created to serve as a guide while you explore the pCloudy platform. It will help you understand how to use, to get quick help and whom to contact while starting off with pCloudy. Though this is not a complete help document, it will act as a quick reference to begin using the platform.

     

    About pCloudy

     

    pCloudy is a mobile application testing platform which will help you to test your apps on hundreds of real devices. You can remotely access real devices and carry out Manual and Automation Testing.

     

    Quick Start

     

    Registration

     

    The platform has a secure login process to protect the apps you test. In order to use the platform you must setup your login credentials first.

     

    Where do I do this?

     

    Simply, enter your details at https://device.pcloudy.com/signup, after a short verification you will be ready to sign-in.

     

    In case of any issues, drop an email to support@pcloudy.com

     

    Sign-in

     

    Once you’ve signed up, you can access the platform with the help of your registered Email ID and Password.

     

    In case of any issues, drop an email to support@pcloudy.com

     

    Note: If your workstation has touch screen feature, enable TouchScreenBrowserSettings

     

    Where do we go from here?

     

    Once you login, you will be exposed to an array of devices and platform features. You might get overwhelmed and lost, but don’t worry, we have you covered.

     

    A typical pCloudy user will follow these steps for testing mobile apps using the platform.

     

    Divided into five parts –

     

    1. How to select right device from the platform?
    2. How to manage apps on the platform?
    3. How to start testing your apps on the selected devices?
    4. How to run automation scripts on cloud-based devices?
    5. Additional Features

     

    1. How to select right device from the platform?

     

    To select the right device on the cloud the platform provides various filters. These filters will help you to select devices based on the OS versions, OEMs, Screen Size, Network, or Device Location.

     

    Mobile Device Testing

     

    There are two modes to access the devices on the cloud –

     

    1. Instant Access – This provides immediate access to the available devices at that moment. Just hit the ‘Connect’ button on any device displayed in the Instant Access page and you will be ready to use the device.

     

    2. Book your Device – In some cases you might want to reserve a device for the future. You can book a device in advance to keep yourself prepared for testing. With careful planning, with the help of ‘Book your Device’ mode you can make sure the devices are available when you need them and save time.

     

    To learn more, refer to these links:

     

    Managing your credits

     

    To use the devices you need to have enough credits in your account:

    • To view the remaining credits in your account refer to this link
    • To buy more credits, click this link

     

    How to manage apps on the platform?

     

    The platform provides secure limited disk space to store the apps on the platform. This space can be used to store app installation files (apk or ipa) or test data (image files, zip, etc).

     

    Refer these links to know how to upload your app files to the platform:

     

    Manual Testing of Mobile Apps

     

    The dashboard provides you with quick and easy access to use the different features to test your mobile apps.

     

    Device Information

     

    1. Device Screen: You can use the device same as how you use a device physically. You can use swipe actions, zoom-in, zoom-out and various gestures to control the device.

    2. Main Panel: This panel provides options to view device info, install/uninstall apps, change device settings, tools to debug apps and run automation, and more.

    3. Quick Action Bar: Frequently used controls like taking Screenshots, changing device orientation, sending text to device, and more

    4. Logs and Performance: Real time device logs and app performance are displayed

     

    Features

    Here’s a list of some important features to test your apps –

     

    1. Functional Tests

    You can install/uninstall apps on the devices, you can use various gestures on cloud based devices just like how you do testing on physical device, you can mock GPS location, take screenshots, and much more. Here are some links that will help you:

     

     

    2. Performance Profiling

     

    Performance profiling of Android Apps – You can monitor the CPU usage, memory usage, battery consumption, frame render count of the app in real-time while testing an app.

    Performance on iOS Device – You can monitor the CPU usage & memory usage of the device in real-time during testing.

     

    3. Debugging mobile apps

    You can capture bug and crash information in the form of logs, screenshots, videos, and stack trace information while testing your apps on devices.

     

     

    4. Test Mobile Web Apps

    You can test your web apps or website on various browsers on various devices.

     

     

    5. Network Virtualization Tool

    The app you tested in your lab environment will not work the same way when you use it in an elevator, or in a basement, or while you are travelling on a highway. The Network Virtualization Tool will help you to emulate different network environments and test your apps.

     

     

    6. Device Tunnel

    You can connect and use a device with ADB just like the way you connect it physically with USB/Wireless ADB. This is used to control a device using ADB commands and debug apps.

     

     

    7. Reports

     

    The reports section will contain the complete details of all your testing sessions. It will hold the screenshots, logs, videos and the performance details of the testing.

     

     

    8. Automation

     

    You can run your automation scripts on multiple devices in parallel. The pCloudy platform supports several automation tools. Here are some links to help you –

     

     

    Other than the reports generated from the automation tools, you can view additional testing reports stored on the platform as well – Automation Testing Reports. This will contain the videos, logs, and performance graphs of the devices on which Automation execution was run.

     

    9. Integration with Continuous Integration tool – Jenkins

     

    You can use CI tools like Jenkins in integration with the pCloudy platform. This integration will leverage your testing practices to a whole new level. You can deliver quality mobile apps continuously by automating the process of build integration using pCloudy plugin for Jenkins.

     

    Team Admin

     

    To effectively manage the devices, users, apps, or credits on the platform you can use Team Admin.
    Refer to article – Team Admin

     

    Contact

     

    Find detailed pCloudy knowledge base articles from support@pcloudy.com
    You can reach out to us – support@pcloudy.com or info@pcloudy.com