Varun Kumar | Posted on | 2 min Read

Espresso is a testing framework for Android which automatically synchronizes your test actions with the UI of your app. It also lets the test wait until all the background activities have finished.
 
The pCloudy utility uploads your Application APK, test APK and other APK files to pCloudy. It will then acquire a device to run your test on, execute those tests and report back the status and test report.
 
In pCloudy you don’t have to set up the environment. Just follow these simple steps.
 
After the test cases are run you can see the detailed reports. Once automation ends, the device under test will be released automatically so that you or other users can use it later.
 
There are two ways you can execute espresso test cases. Here are the steps for both
 
1. pCloudy UI Dashboard
a. In pCloudy UI there is a section called Automation where you will find multiple automation frameworks integrated to the platform.
b.Select the Espresso automation and to fill in the required details.

 
Espresso-on-pCloudy
c. pCloudy Support two TestRunners.
i. AndroidJUnitRunner (android.support.test.runner.AndroidJUnitRunner)
ii. AndroidXJUnitRunner (androidx.test.runner.AndroidJUnitRunner)
 
Espresso-on-pCloudy
d. Select your Application and Test Application.
 
Espresso-on-pCloudy
e. Select the required devices.
 
Espresso-on-pCloudy
f. Click on Next button and Schedule the automation by clicking on the Schedule button.
 
Espresso-on-pCloudy
g. You will get a dialog box. Click on Ok.
 
Espresso-on-pCloudy
Espresso-on-pCloudy
h. You will get the active session details on the Dashboard and you will also be able to see the Live view.
 
Espresso-on-pCloudy
i. Liveview will help you to see the live execution on your test cases. Click on the Liveview icon
 
Espresso-on-pCloudy
2.pCloudy Utility
 
a. Download the espresso starter pack from here and Unzip it
b. You will find two files,
i. pCloudy_Espresso.jar
ii.Config.properties
c. Place the config.properties file and pCloudy_Espresso.js file into the same directory.
d. Update the config.properties file as guided in the comments in the file.
e. In your workspace, run the command by typing the java -jar pCloudy_Espresso.jar
 
Espresso-on-pCloudy
f. This will upload the required files which you have mentioned inside the config.properties files.

g. You will get the status of the Automation in pCloudy Dashboard ActiveSession.
 
Espresso-on-pCloudy
 
h. Even on the pCloudy dashboard, you can use the Liveview by which you can see the running test cases.
 
Espresso-on-pCloudy
i. Once the test execution is over, You will get a URL of the test execution report on the terminal.
 
Espresso-on-pCloudy
j. You can open the report from the dashboard Report section also. In the report, all the test details will be there as shown in the screenshots below.
 
Espresso-on-pCloudy
 
k. You will also get individual device reports. Inside the test case level details, you will find performance details, test case logs, device logs, and video files.
 
Espresso-on-pCloudy
Espresso-on-pCloudy

Suyash Dubey | Posted on | 2 min Read

Appium vs Espresso

 

Mobile app automation testing has evolved as a crucial aspect of the mobile app development process to help deliver better quality solutions, under controlled time cycles and cost schedules. But for delivering bug-free app, choosing the best suitable automation testing framework for your app is very important. There are many automation testing frameworks available in the market with exceptional capacities. This blog is all about Appium vs Espresso and we will analyze which of these two most widely used Automation testing frameworks is preferable for your app testing.

 

Espresso was not preferred because of its flakiness and instability issues. But, from the time Google has brought Android Test Orchestrator, a Gradle test option, instability and unreliability of Android Espresso tests have vanished. This, in turn, is creating a serious problem for the most popular automation framework Appium.

 

Let’s find out in this blog if Espresso now comes with a power to kill Appium or Appium can hold its stand in this fiercely competitive market.

Appium vs espresso1
Let’s get into the details.
 
What is Appium?

It is an open source, cross-platform mobile app automation testing framework. Appium allows native, hybrid and web app testing and supports automation test on physical devices as well as emulators or simulators. The Appium server uses selenium web driver which permits platform independence and allows the user to use the same code for Android or iOS.

 
Advantages of using Appium

  • Facilitates test execution without server machines
  • Appium is developed using cross-platform runtime environment like NodeJs which enables programmers to write server-side code in javascript. It is designed as an HTTP server and you can run the test without requiring a server machine.

     

  • Does not require app code recompilation
  • Most of the automation testing tools require testers to alter app code. Some of the test automation frameworks require testing professionals to recompile the code according to the targeted mobile platforms. Appium enables testers to evaluate both cross-platform and native apps without recompiling and altering the code that often.

     

  • Automates various types of mobile apps
  • Testers can avoid using different automation tools for different types of apps as Appium can be used for web apps, hybrid, and native apps too. It facilitates the testing of hybrid and mobile web apps as a cross-platform test automation framework. At the same time, it enables testers to test native apps through web driver protocol.

     

  • Testers can use real devices, emulators, and simulators
  • Testers use real devices to evaluate mobile app’s usability and user experience more precisely. Although, to speed up the mobile app testing one needs to use emulators or simulators too. Appium helps testers to produce reliable test results and reduce testing time by supporting real devices, emulators and simulators.

     

  • Provides a record and playback tool
  • In Appium, testers can use the inspector to accelerate testing through record and playback functionality. Appium inspector can record the behavior of native apps by inspecting their document object model (DOM). Record and playback tool can produce test scripts in a number of programming languages.

     

  • Testers can automate apps without adding extra components
  • Testers can execute the same test across multiple mobile platforms without putting extra time and efforts or adding extra component. Appium simplifies automation by keeping complexities in Appium server.

     

  • Supports several web driver compatible languages
  • You can integrate Appium with many testing frameworks and WebDriver – compatible languages including PHP, Java, Ruby, Javascript, C# and Objective C. Hence, a tester has the option to write test scripts in his preferred programming language.

 
Disadvantages of using Appium

  • Common gestures
  • Appium lacks commonly used gestures like double-clicking in java-client libraries. It also does not support Android alert handling directly and the users cannot evaluate alert handling through native API. Testers have to put extra time and effort to test these gestures.

     

  • No script execution on multiple iOS simulators
  • Simulators make it easier for testers to mimic internal behavior of the underlying iOS devices. Although Appium does not allow users to run multiple test scripts on multiple simulators simultaneously.

     

  • Lacks the capability to recognize images
  • Appium cannot locate and recognize images automatically to evaluate games and apps precisely. The testers have to take help of screen coordinates to make Appium locate and recognize images.

     

  • Does not support older versions of android
  • Appium supports only Android 4.2 and later and does not supports older APIs for Android. There are still many people using devices which run on older versions of Android and developers find it difficult to test mobile apps developed targeting older Android API level.

 
What is Espresso?

Espresso is a tool developed by Google which is used for testing the UI of Android apps. It automatically synchronizes your test actions with the user interface of the mobile app and ensures that the activity is started before the tests run.

 

Although when you execute an Espresso test you will have shared state in separate tests and some flakiness. For this Google came up with a solution. Android Test Orchestrator is a Gradle test option that helps in testing and increases the reliability of our automated test suites.

 

If you use Gradle build tools in any version of Android Studio below 3.0 then you also have to update the dependency setup. Let’s take a look at the advantages of using Android Espresso.

 
Advantages of using Espresso

  • Integration with Gradle
  • The new Android Espresso now has the power of the Android Studio and Gradle that comes along with it. So now invoking your tests, running it or modifying it is just a matter of calling a Gradle command. This gives the full power of command line to the developer and makes testability much easier.

     

  • Test Orchestrator
  • The new Android Espresso comes with the power of Android Test Orchestrator that allows you to run each of your app’s tests within its own invocation of Instrumentor. It ensures that there is minimum shared state and crashes being isolated. It allows you to filter the tests that you want to run and also distribute tests across devices. This implies that you have finer control over how your tests run.

     

  • Less flakiness
  • The scalability of the test cycle in Android Espresso is high due to the synchronized method of execution. A built-in mechanism in Espresso that validates that the object is actually displayed on the screen. This saves test execution from breaking when confronted with “Objects not detected” and other errors.

     

  • It’s easy to develop Espresso test automation
  • Test automation is based on Java and JUnit which Android developers are familiar with. There is no setup or ramping up to implement quality in the in-cycle stage of the app SDLC.

     

  • Reliable and fast feedback
  • Android Espresso does not need any server to communicate with, instead, it runs side by side with the app and delivers fast results. It gives fast feedback to the code changes so that developers can move to the next bug fix.

     

  • Simple workflow
  • Espresso allows developers to build a test suite as a stand-alone APK that can be installed on the target mobile alongside the app under test and be executed quickly.

 
Disadvantages of using Espresso

  • It requires access to the application source code
  • Without the source code, you won’t be able to do anything. Also, There is a risk to get used to the in-built test synchronization and UI – then it might be hard to work with WebDriver.

     

  • Narrow focus
  • If UI tests are required for both Android and iOS, it will be necessary to write twice, for two different systems. If tests require to work with Android outside the application (for example, open a received notification with a text message), you’ll have to use additional tools, such as UIAutomator.

     

  • Knowledge of launching Android app on emulators required
  • It is desirable to have at least minimal experience of building and launching Android applications on emulators.

 
Conclusion

Appium and Espresso both can be used to perform UI testing on Android app but if you have to choose one of them then you need to decide on the bases of your requirements. What kind of app is it and what kind of testing you want to perform. Developers who want to perform UI testing for their native Android app should go for Android Espresso. Although, if the test needs to support iOS and Android both and you want to test at a functional level then you can use Appium.

 
Related Articles:

  • Automated Testing Using Espresso
  • How to use Appium Inspector for Test Automation
  • How to Run Espresso Test on Remote Devices
  • Espresso with pCloudy.com
  • Run Espresso in pCloudy Using Gradle
  • 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
  • pCloudy 2016 at a Glance

     

    I hope you had an amazing year, so we hope you are enjoying the festive time with your family and friends. We would like to take a moment to thank you for supporting us through out the year, which has been a great year for pCloudy. We achieved several milestones in the year 2016. Here is summing up the year. Thanks again and wishing you happy holidays.

    Summing Up the Year

    Geography

    pCloudy extended its device cloud operations to US and Philippines. Our customers are now able to test their Apps on local devices and local networks of India, US and Philippines.

    world-template

    Device Cloud Growth

    We grew rapidly this year becoming one of the largest device cloud provider from India.

    2016-achievements

    Industry Recognition

    pCloudy got recognition from top Industry Analysts from across the globe.

    Gartner_logo ET Telecom tech-portal

    Presence in Global Events

    pCloudy was part of all major global testing conferences. Support of audience was phenomenal.

    Jenkins World 2016

    jenkinsjenkins-world-2016

    Software Testing 2016

    stc-event-pcloudystc-logo

    Start East Testing 2016

    star-east-pcloudystareast

    New and Improved UI for Device Access

    Based on feedbacks from users, we came up with new UI for device access page. Now it’s easier and faster to test Apps on devices. We received many thumbs up from the users.

    new-ui

    Launch of in-built Automation Engine (OpKey Integration with pCloudy)

    pCloudy becomes the only device cloud to have a record and playback engine in-built. This allows customers to quickly create automated scripts without writing a single line of code.

    opkey-spy-mode

    Robotic Integration for IOT App Testing

    The future of app testing in IoT lies in integrating app interaction with external hardware triggers. pCloudy released it’s first version of pBot for NFC and Payment terminal testing.

    roboticintegration

    Advance Features

    We implemented many new features to ensure that our users gets full range of Test capabilities for their Mobile Apps.

    ADB Bridge – Developers can use this feature for real time debugging of their Apps

    adbconnect

    Network Simulation – Now Apps can be tested on variety of Network conditions

    network_simulation_ui

    Automation Live view – While users could run their tests on multiple devices, now they can see it as well

    automationliveview

    Support for new tools

    pCloudy now supports most of the popular open source tools used by Dev and Test community. We added Espresso, Monkey Test

    espresso-new monkey-test

    Many New Integrations

    While we had a great working platform in by the end of 2015, there were still several integrations required. We wanted to give far more to our customers – Jenkins, Android Studio Plug-in, Eclipse Plug-in.

    jenkins android-studio eclipse

    A Lot of Fun

    fun-activities

    Final Words

    We are very happy about all of our achievements in 2016, but even more so, we wish you many new exciting starts and remarkable successes in 2017. Our team will continue to exert every effort to improve our products and make your Mobile App triumph with pCloudy platform.

    Have a Happy Holiday and New Year.

    Automation Testing With Espresso

     

    Now you can run your Espresso Scripts on hundreds of Mobile devices over pCloudy.com.

    Espresso is a testing framework for Android apps. The platform allows you to write concise and reliable Android UI tests. pCloudy.com provides you the platform to run these scripts on multiple mobile devices of your choice.

    Here are the steps for running your Test Scripts on multiple Android Devices:

    • Login over www.pcloudy.com with your registered Email ID & Password.
    • Choose Instrumentation Type based on your Test Scripts you’ve written. pCloudy provides support for Instrumentation Type
    • (InstrumentationTestRunner, AndroidJUnitRunner) for Android. For more information, see Instrumentation in the Testing Fundamentals section of the Android Developer Tools documentation.
    • Go to the Automator Page
    • Select Android OS version & Manufacturer
    • Choose Espresso (to run Espresso Scripts)
    • Select Instrumentation Type (TestInstrumentationRunner/AndroidJUnitRunner).
    • Select Application .apk file (the App to be tested)
    • Select Test Script .apk file (the Test Script developed for testing)
    • Enter Single Device execution Time (Time required for the entire script to be executed on single device)
    • Enter Name of your Test Cycle (this name will represent your Test Cycle)
    • Click on Schedule Test Cycle

    test-automator

    In the next step, you need to confirm schedule of test automation. Here, you can see your selected application, test script, device etc.

    confirm-test-cycle

    Further, you get a pop up message of test automation schedule confirmation.

    Click on OK to proceed.

    test-cycle-scheduling-successful

    Go to your mailbox and open pCloudy Automation Alert mail.
    Click on the given link “Click to view Report”.

    simplest-online-device-cloud

    Finally, you get result of your scheduled test automation.

    cloud-automator-report

    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: