Skip to main content
Documentation|Espresso

Last updated on : 21 Jan 2025

Espresso

Overview

Pcloudy Espresso integration allows you to run Android Espresso test suites on real devices hosted in the Pcloudy cloud directly from your local machine. You configure a single JSON file, run the provided JAR, and Pcloudy handles device booking, APK upload, test execution, and report generation automatically.

Key Highlights

  • Parallel execution on real devices
  • Live-view streaming during test run
  • Detailed HTML/JSON reports on the Pcloudy portal
  • Terminal output with the report URL on completion

Prerequisites

  • Valid Pcloudy account
  • API Key (Available under your Pcloudy profile settings)
  • Espresso Starter Pack

Steps

  1. Download and Unzip the Espresso Starter Pack

Download the Espresso Starter Pack from the Pcloudy portal. Once downloaded, unzip the archive. You will find exactly two files inside:

FilePurpose
Pcloudy_Espresso.jarThe executable JAR that reads your config, uploads APKs, books devices, and triggers test execution on the Pcloudy cloud Download JAR
config.jsonThe configuration file where you define your cloud credentials, device selection, APK paths, and test settings Download Config.json
info

Important Keep both files in the same directory. The JAR reads config.json from the current working directory by default.

  1. Place Both Files in the Same Directory

Copy or move both files into a dedicated working folder on your machine. For example:


C:UsersYourNameEspressoRunner ├── Pcloudy_Espresso.jar
└── config.json
tip

Tip - You do not need to place your APK files in this folder. APK paths in config.json can point anywhere on your file system using absolute paths.

  1. Configure the config.json File

Open config.json in any text editor and fill in the required values. The file is structured into four sections: Cloud Settings, Test Execution, Application Files, and Test Settings.

Complete config.json Reference

Java

{
"PcloudyConfiguration": {
"cloudSettings": {
"endpoint": "cloudURL/",
"authentication": {
"username": "Username",
"apiKey": "***********"
}
},

"testExecution": {
"durationInMinutes": 10,
"deviceFullName": [
"SAMSUNG_S7Edge_Android_8.0.0_85b07"
],
"testCycleName": "testMain_ESPRESSO_SESSION"
},

"applicationFiles": {
"apkFilePath": "VectorApp_Espresso.apk",
"testApkPath": "VectorApp_EspresoTestCases.apk",
"orchestratorApkPath": "VectorApp_Espresso.apk",
"serviceApkPath":"VectorApp_Espresso.apk"
},
"testSettings": {
"suites": [],
"testRunner":
"android.support.test.runner.AndroidJUnitRunner",
"testRunnerOptions": [
"android.support.test.runner.AndroidJUnitRunner",
"androidx.test.runner.AndroidJUnitRunner"
],
"clearPackageData": false,
"appPermissionGrant": true,
"appUpload": false
}
}
}

Section A — cloudSettings

Config KeyValue/ ExampleDescription
endpointcloudURLYour Cloud URL. Must end with a trailing slash. Example: https://device.Pcloudy.com/
usernameUsernameYour registered Pcloudy email address
apiKey*********Login-> Go to main menu-> quick action-> Copy access key

Section B — testExecution

Config KeyValue/ ExampleDescription
durationInMinutes10Maximum duration (in minutes) for which the device session will be booked. Increase for longer test suites.
deviceFullName["SAMSUNG_S7Edge_Android_8.0.0_85b07"]Array of device identifiers. Add multiple entries for parallel execution on multiple devices. Get the exact device name from the Pcloudy Capability configurator.
testCycleNametestMain_ESPRESSO_SESSIONA label for this test run. Used to identify the session in the Pcloudy Reports dashboard.
info

Multiple Devices To run on multiple devices simultaneously, add more entries to the deviceFullName array: "deviceFullName": ["SAMSUNG_S7Edge_Android_8.0.0_85b07", "OnePlus_9_Android_11.0_xyz"]

Section C — applicationFiles

Config KeyValue/ ExampleDescription
apkFilePathAbsolute path to .apkPath to the main application APK under test. Use double backslashes (\\) on Windows.
testApkPathAbsolute path to test .apkPath to the Espresso test APK containing your test cases.
orchestratorApkPathAbsolute path to .apkPath to the Android Test Orchestrator APK (optional but recommended for test isolation).
serviceApkPathAbsolute path to .apkPath to the test services APK. Required when using Orchestrator.
warning

Windows Paths - On Windows, use double backslashes in JSON paths: C:\\Users\\Name\\folder\\file.apk On macOS/Linux, use forward slashes: /Users/Name/folder/file.apk

Section D — testSettings

Config KeyValue/ ExampleDescription
suites[]Array of test suite names to run. Leave empty [] to run all test cases in the test APK.
testRunner"android.support.test.runner.AndroidJUnitRunner"The primary test runner class. Use AndroidJUnitRunner for standard Espresso tests.
testRunnerOptions["...JUnitRunner", "androidx...JUnitRunner"]Array of runner options. Include both legacy (android.support) and AndroidX runners to support a wider range of test APK builds.
clearPackageDatafalseSet to true to clear app data between test runs. Useful for stateful apps. Default: false.
appPermissionGranttrueSet to true to automatically grant all runtime permissions to the app. Recommended for most test scenarios.
appUploadfalseSet to true to force re-upload of APK files even if they already exist in Pcloudy. Set to false to reuse previously uploaded files and save time.
info

appUpload = false (Re-use uploaded APKs) If your APKs have not changed since the last run, set appUpload to false. The JAR will reuse the previously uploaded versions, making the start-up faster. Set to true whenever you have a new build.

3. Running the Test

Execute the JAR from the Command Line

Open a terminal or command prompt, navigate to the directory containing both files, and run the following command:


# Navigate to your working directory
cd C:UsersYourNameEspressoRunner
# Run the Espresso JAR
java -jar Pcloudy_Espresso.jar

The JAR will now automatically:

  1. Read your config.json configuration
  2. Authenticate with the Pcloudy cloud using your credentials
  3. Upload the APK files specified in applicationFiles (if appUpload is true)
  4. Book the specified device(s) for the configured duration
  5. Install the app APK and test APK on the booked device
  6. Execute the Espresso tests using the configured test runner
  7. Stream execution logs to your terminal in real-time
  8. Release the device and publish the test report
  9. Print the report URL to the terminal on completion

Expected Terminal Output

During execution you will see output similar to:


[Pcloudy] Authenticating user: anjali@example.com
[Pcloudy] Uploading APK: VectorApp_Espresso.apk ...... Done
[Pcloudy] Uploading Test APK: VectorApp_EspresoTestCases.apk ...... Done
[Pcloudy] Booking device: SAMSUNG_S7Edge_Android_8.0.0_85b07
[Pcloudy] Device booked successfully. Session ID: testMain_ESPRESSO_SESSION
[Pcloudy] Installing app on device ...... Done
[Pcloudy] Starting test execution ...
[Pcloudy] Test 1/20 - testLoginSuccess PASSED (1.2s)
[Pcloudy] Test 2/20 - testLoginInvalidPassword PASSED (0.9s)
[Pcloudy] Test 3/20 - testAddToCart FAILED (2.1s)
...
[Pcloudy] Execution complete. Duration: 8m 34s
[Pcloudy] Report URL: https://device.Pcloudy.com/reports/session/abc123
info

Copy the Report URL - Save the report URL printed at the end of the terminal output. You can open it in any browser to view the full test report without logging in to the portal (if your account has public reports enabled).

4. Viewing the Live Execution (Live-View)

While your tests are running, you can watch them execute in real-time on the actual device from the Pcloudy portal.

Access Live-View During Execution

StepActionWhat You See
1Log in to the Pcloudy platform in your browserPcloudy dashboard loads
2Click ‘My Active Sessions’ tab in main menuA list of your currently running test sessions appears. Your session is identified by the testCycleName value from config.json (e.g. testMain_ESPRESSO_SESSION)
3Locate your session row and click the ‘Live-View’ icon (camera/play icon) on the right side of the rowA real-time device screen stream opens in your browser. You can see the test cases executing on the physical device - taps, swipes, assertions - all live.
info

Live-View Tip - Live-View is read-only. You cannot interact with the device during automated test execution. Use it to monitor progress and catch issues early without waiting for the full report.

5. Viewing the Test Report

Once the test execution is complete, a detailed report is automatically published to the Pcloudy portal. There are two ways to access it:

5.1 Via the Terminal URL

The terminal prints a direct URL at the end of execution:


[Pcloudy] Report URL: https://device.Pcloudy.com/reports/session/abc123

Open this URL in a browser to view the report immediately. No portal login required if your account settings allow public report access.

5.2 Via the Pcloudy Portal

Access the Report from the Pcloudy Portal

StepActionWhat You See
1Log in to PcloudyDashboard loads
2Click ‘REPORTS’ in the top navigationReports section opens with tabs
3Click ‘All Reports’ tabA list of all past and current test sessions appears, sorted by most recent first
4Locate the report by testCycleName or timestampYour session row is visible: testMain_ESPRESSO_SESSION with date, device name, status
5Click on the report row or the report linkThe full test execution report opens

5.3 What the Report Contains

The test report on the Pcloudy portal provides the following information:

Pcloudy - Report

espresso

Report SectionDetails
Session SummaryTest cycle name, device used, total duration, start time, pass/fail counts, overall status
Test Case ListEach individual test case listed with: test name, execution status (PASSED / FAILED / SKIPPED), execution time in seconds
Failure DetailsFor failed test cases: stack trace, assertion error message, the exact line of code that failed
Device LogsFull logcat logs captured during execution, filterable by tag or log level
ScreenshotsAutomatic screenshots captured at each test step (if screenshot capture is enabled in test settings)
Video RecordingFull screen recording of the test session playback (if recording is enabled for your Pcloudy plan)
Network LogsHTTP network traffic captured during the session (if network capture is enabled)
Performance MetricsCPU and memory usage graphs for the app under test during execution

6. Failed Test Cases

Users can:

  • View complete failure details
  • Expand error logs
  • Copy failure messages and stack traces for further analysis
  • Download logs for debugging purposes

Each failed test case provides:

  • Failure reason
  • Stack trace
  • Execution time
  • Step-level breakdown (if enabled)

This allows faster root cause analysis and defect tracking.

espresso

Key Takeaways

  • Test coverage execution status is clearly visible.
  • Failed test cases are traceable with detailed logs.
  • Performance graphs provide runtime insights.
  • Execution artifacts (logs, video, screenshots) support effective debugging.

Did this page help you?