Category:

Run Espresso on pCloudy using pCoudy Utility

October 23rd, 2019 by

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

Run Espresso in pCloudy Using Gradle

April 5th, 2019 by

Do you know why Google has selected Gradle as the build system for Android Studio? Many Android developers work in a heterogeneous environment with different technology stacks. Gradle solves some of the hardest problems faced by the developers like how to automate the testing of apps and how to manage dependencies and variations that allow professional developers to develop variations of their app with one click. This is why pCloudy came up with a new update where you can now run Espresso with Gradle on pCloudy devices. Let’s get a brief introduction about Espresso and Gradle before we learn how to run Espresso with Gradle on pCloudy devices.
 
Espresso is a testing framework for Android which automatically synchronizes your test actions with the UI of your app. It also let the test wait until all the background activities have finished.
 
Gradle is an open source advanced build tool that allows seamless execution of tasks. It uses domain specific language and it is based on Groovy and Kotlin. It is a plugin based system so if you want to automate the task of building some package from sources then you can write the complete plugging in Java and share it with the world.
 
Gradle allows efficient and repeatable use of espresso and Test Orchestrator which allows automated yet fine-tuned control of the way you run your test. You can decide which specific test suites to be run to distribute the test cases across different devices. It is preferred by developers as it allows deep unit and functional testing rigs.
 

Power up your DevOps with Espresso and Gradle on pCloudy

You would be running Espresso on your machine using Android Studio and Gradle. However, the test would be running on pCloudy device. There is a pCloudy Espresso script that is provided by us and you need to put that espresso script in the workspace of the project. Along with the Gradle script, you will also get a config file. The gradle script will read input parameters from this config file.
 
Then you run Gradle to invoke the script which will upload your Application APK, test APK and other APK files to pCloudy. It would acquire a device to run your test on, it would execute those tests it will report back the status of what is happening into the Android Studio. After the test cases are run you can see the detailed reports and after that gradle script will release the device for other users to use.
 
There is a one-time setup that you need to do to place the gradle script in the workspace and you need to fill in the configuration file. So when you run the gradle script it will complete all the task for you and generate the report.
 

Steps to run Espresso with Gradle on pcloudy

 
1. Download the espresso starter pack from here and Unzip it
2. You will find three files,
a. pCloudy_Espresso.jar
b. Config.properties
c. build.gradle.SAMPLE
(This is a sample build.gradle that shows how to change your build.gradle to add the pCloudy Espresso jar.)
3. Copy the contents of the file build.gradle.Sample to the build.gradle file of your Android Application to register the new Gradle task and update as appropriate (see the image below)
 
33

4. Place the config.properties file in your android workspace in the same directory as your build.gradle file.
 
sdgef
5. Update the config.properties file as guided in the comments in the file.

6. In your Android workspace run the command by typing the name of the gradle task as below.
 
tttt
7. Once the test execution is complete you will get a URL of the test execution report. Some fields in the report are empty right now. We will fix them in subsequent phases.
 
rrr
The use of gradle has made it easier to run Espresso test on pCloudy devices. We can just use the configuration file and easily run the test scripts on pCloudy devices. This will save time and effort as it further simplifies the app testing process in pCloudy.
 
You can watch our webinar for more information.

 
Related Articles:

  • How to Run Espresso Test on Remote Devices
  • Appium vs Espresso: The Most Popular Automation Testing Framework in 2019
  • Run Espresso on pCloudy using pCoudy Utility
  • Automated Testing Using Espresso
  • Espresso with pCloudy.com
  • Appium vs Espresso: The Most Popular Automation Testing Framework in 2019

    March 27th, 2019 by

    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
  • How to Run Espresso Test on Remote Devices

    March 12th, 2019 by

    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
  • Automated Testing Using Espresso

    August 25th, 2016 by

    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