Skip to content

Repository that contains examples of using Espresso for automation

Notifications You must be signed in to change notification settings

saucelabs-training/demo-espresso

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Espresso examples

For Demonstration Purposes Only
The code in these scripts is provided on an "AS-IS" basis without warranty of any kind, either express or implied, including without limitation any implied warranties of condition, uninterrupted use, merchantability, fitness for a particular purpose, or non-infringement. These scripts are provided for educational and demonstration purposes only, and should not be used in production. Issues regarding these scripts should be submitted through GitHub. These scripts are maintained by the Technical Services team at Sauce Labs.

Introduction

This repository will hold multiple examples on how to run Espresso tests on the Sauce Labs cloud. This can be on Android Emulators, Sauce Labs Android real devices or both at the same time, see example 8! More information on how to use it can be found below and in each folder.

Prerequisites

  • Please check our documentation for installing SauceCTL
  • Make sure you've set up your credentials on your local machine and or CI-pipeline, see this-doc
  • Check the Espresso-docs for all options

Install saucectl

curl -L https://saucelabs.github.io/saucectl/install | bash

⚠️ Make sure saucectl version is newer than v0.44.0

Apps

A prebuilt native Android application and it's Espresso test cases are included in this repo. Source to this application can be found on GitHub in this folder. The test-classes can be found here.

The application is bundled in mda-1.0.8-10.apk and the tests cases are bundled in mda-androidTest-1.0.8-10.apk.

Examples

All below mentioned examples can be found in the .sauce-folder. You can run the configurations by running the following command from the root of this folder

  saucectl run --config ./.sauce/runner-ex{#}.yml

The # stands for the number of the below mentioned examples.

Example 1 - Minimal configuration for all tests

runner-ex1.yml provides a minimum configuration needed to run the Espresso tests. In this example, all test cases are executed on a single, available device in sequential order.
Espresso - Example 1

Example 2 - Minimal configuration for 2 tests

runner-ex2.yml provides a minimum configuration needed to run the Espresso tests. In this example, there are two test cases executed on a single, available device in sequential order.
Espresso - Example 2

Example 3 - Run each test on its own device

runner-ex3.yml breaks apart the execution of the two test cases such that they can run in parallel on separate devices that are available (ie., not in use) in the pool.
Espresso - Example 3

Example 4 - Run in parallel on hard-coded devices

runner-ex4.yml modifies the second example by specifying which device in the pool to execute each test on. Still uses parallel execution.
Espresso - Example 4

Example 5 - Parallel execution using dynamic devices

runner-ex5.yml uses the deviceNameQuery capability to look for available devices using wildcard names. This example demonstrates the ability to run a specified test(s) on a pool devices that are configured the same but have different names for parallel processing.
Espresso - Example 5

Example 6 - Parallel execution by platform version

runner-ex6.yml uses only the platformVersion field to select an available device. Demonstrates the ability to pick a specific version of Android from the pool of devices for executing tests in parallel.
Espresso - Example 6

Example 7 - Single file test annotation

runner-ex7.yml uses Espresso test annotation. Demonstrates the ability to run four tests based on the @ErrorFlow-annotation in a single class, see here.
Espresso - Example 7

Example 8 - Single execution on Android Emulators and Android Real Devices

runner-ex8.yml runs espresso tests on both Android Emulators AND Android Real Devices.
Espresso - Example 8

Example 9 - Shard all tests over multiple instances

runner-ex9.yml runs espresso all tests on multiple Android Real Devices and Android Emulators by automatically sharding the tests. saucectl automatically creates the sharded jobs for each of the devices defined for the suite based on the number of shards you specify.
Espresso - Example 9

About

Repository that contains examples of using Espresso for automation

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •