id | title | sidebar_label | description | keywords | url | site_name | slug | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
hyperexecute-espresso-testing |
Espresso Testing On HyperExecute |
HyperExecute Espresso Testing |
Follow the instructions in this documentation, so that you can seamlessly execute Espresso tests on HyperExecute via LambdaTest. |
|
LambdaTest |
hyperexecute-espresso-testing/ |
import CodeBlock from '@theme/CodeBlock'; import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/component/keys";
<script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify({ "@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [{ "@type": "ListItem", "position": 1, "name": "Home", "item": "https://www.lambdatest.com" },{ "@type": "ListItem", "position": 2, "name": "Support", "item": "https://www.lambdatest.com/support/docs/" },{ "@type": "ListItem", "position": 3, "name": "Getting Started With espresso Testing on LambdaTest", "item": "https://www.lambdatest.com/support/docs/hyperexecute-espresso-testing/" }] }) }} ></script>This page outlines how to execute your Espresso tests on HyperExecute using concepts of Sharding
HyperExecute uses YAML 0.2 to perform the tests using Espresso.
To run the Tests on HyperExecute from your Local System, you are required:
- Your lambdatest Username and Access key
- HyperExecute CLI in order to initiate a test execution Job.
- Setup the Environmental Variable
- HyperExecute YAML file which contains all the necessary instructions.
- Access to an Android app (.apk or .aab file).
If you do not have any .apk you can run your sample tests on LambdaTest by using our sample 🔗 Android app.
The HyperExecute CLI is used for triggering tests on HyperExecute. It is recommend to download the HyperExecute CLI binary on the host system to perform the tests on HyperExecute. The CLI download site for various platforms is displayed below:
Platform | HyperExecute CLI download location |
---|---|
Windows | https://downloads.lambdatest.com/hyperexecute/windows/hyperexecute.exe |
macOS | https://downloads.lambdatest.com/hyperexecute/darwin/hyperexecute |
Linux | https://downloads.lambdatest.com/hyperexecute/linux/hyperexecute |
Export the environment variables LT_USERNAME and LT_ACCESS_KEY that are available in the LambdaTest Profile page. Run the below mentioned commands in the terminal to setup the CLI and the environment variables.
For macOS:
export LT_USERNAME=YOUR_LT_USERNAME
export LT_ACCESS_KEY=YOUR_LT_ACCESS_KEY
For Linux:
export LT_USERNAME=YOUR_LT_USERNAME
export LT_ACCESS_KEY=YOUR_LT_ACCESS_KEY
For Windows:
set LT_USERNAME=YOUR_LT_USERNAME
set LT_ACCESS_KEY=YOUR_LT_ACCESS_KEY
Upload your android application (.apk file) to the LambdaTest servers using our REST API. You need to provide your Username and AccessKey in the format Username:AccessKey
in the cURL command for authentication. Make sure to add the path of the appFile in the cURL request.
Here is an example cURL request to upload your app using our REST API:
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
Using App File:
Response of above cURL will be a JSON object containing the
App URL
of the format - lt://APP123456789123456789 and will be used in the next step.
Upload your test suite (.apk file) to the LambdaTest servers using our REST API by providing your Username and AccessKey in the format Username:AccessKey
in the cURL command for authentication.
Here is an example cURL request to upload your app using our REST API:
Now execute your test by using the following command in your terminal:
chmod u+x <YOUR_CLI_FILE_NAME>
./<YOUR_CLI_FILE_NAME> -user <UserName> -key <AccessKey> --verbose -i <yamlFileName>.yaml
Example Reference with Output:
chmod u+x ./hyperexecute
./hyperexecute -user <UserName> -key <AccessKey> --verbose -i <yamlFileName>.yaml
-
Now, go to the HyperExecute Dashboard and click on your executed Job. <img loading="lazy" src={require('../assets/images/hyperexecute/frameworks/espresso/espresso-he.webp').default} alt="cmd" width="768" height="373" className="doc_img"/>
-
Click on the View Test button to check the logs in the App Automation Dashboard. <img loading="lazy" src={require('../assets/images/hyperexecute/frameworks/espresso/espress-he-app.webp').default} alt="cmd" width="768" height="373" className="doc_img"/>
Sharding is a mobile test automation technique that distributes test cases across multiple real and virtual devices via parallel testing. It entails breaking down test suites into smaller subsets known as shards and running each shard concurrently on separate test execution environments.
There are two types of Sharding:
This feature enables users to manually specify shards along with their definitions, offering multiple strategies such as class, package, and more. By doing so, users can have greater flexibility and control over the sharding process.
version: "0.2"
concurrency: 2
runson: android
autosplit: false
framework:
name: "android/espresso"
args:
buildName: "Espresso"
video: true
deviceLog: true
# You can use either the appId (lt://APP1234567) or provide the path of the application using appPath. Both examples are given below.
#highlight-next-line
appPath: Proverbial.apk
testSuitePath: ProverbialExpressoTest.apk
# We have used the appPath and testSuitePath here.
#highlight-next-line
appId: lt://APP1010461471690377432133206
testSuiteAppId: lt://APP10104592261690377454846669
# We have used the appId and testSuiteAppID here.
deviceSelectionStrategy: all
devices: ["Galaxy.*", "Pixel.*"]
shards:
mappings:
- name: shard1
strategy: "class"
values: ["com.lambdatest.proverbial.BrowserTest"]
# The strategy for this shard is based on "class".
# This shard will run all tests from the class com.lambdatest.proverbial.BrowserTest.
- name: shard2
strategy: "package"
values: ["com.lambdatest.proverbial"]
# The strategy for this shard is based on "package".
# This shard will run all tests that belong to the package com.lambdatest.proverbial.l.
- name: shard3
strategy: "skipClass"
values: ["com.lambdatest.proverbial.BrowserTest"]
# The strategy for this shard is to skip a specific class.
# This shard will avoid running tests from the class com.lambdatest.proverbial.BrowserTest.
The system intelligently determines the distribution of tests across devices, employing specific criteria to optimize the testing process.
version: "0.2"
concurrency: 2
runson: android
autosplit: true
framework:
name: "android/espresso"
args:
buildName: "Espresso"
video: true
deviceLog: true
# You can use either the appId (lt://APP1234567) or provide the path of the application using appPath. Both examples are given below.
#highlight-next-line
appPath: Proverbial.apk
testSuitePath: ProverbialExpressoTest.apk
# We have used the appPath and testSuitePath here.
#highlight-next-line
appId: lt://APP1010461471690377432133206
testSuiteAppId: lt://APP10104592261690377454846669
# We have used the appId and testSuiteAppID here.
deviceSelectionStrategy: all
devices: ["Galaxy.*", "Pixel.*"]
:::tip
-
When Shards are added :
-
If you are using the
deviceSelectorStrategy: all
,then in that case all the specified shards will be executed on every device available. -
If you are using the
deviceSelectorStrategy: any
, then in that case all the specified shards will be executed on just one device from the provided list.
-
-
When Shards are not added :
-
If you are using the
deviceSelectorStrategy: all
, then in that case the tests will be executed on all mentioned devices in.yaml
based on the concurrency. -
If you are using the
deviceSelectorStrategy: any
, then in that case all the specified tests will be executed on each device from the provided list, considering the concurrency setting.
:::
-
By following the instructions in this documentation, you can seamlessly execute the espresso tests on HyperExecute, leveraging its secure cloud infrastructure, advanced features, and optimized test execution workflow.