Skip to main content

Test Observability on Espresso

Quick start guide to integrate BrowserStack Test Observability with Espresso

Prerequisites

  • You have an account with BrowserStack (even a free trial works) and can get the Username and Access Key from your account profile.
  • You have a pre-existing Espresso test suite integrated with BrowserStack App Automate.
  • Espresso tests are built into a separate apk file from your app. Hence, you will need access to both the app (.apk or .aab) and the Espresso test suite (separate .apk file).
Note: If you do not have .apk files and want to try App Automate, you can download our sample Calculator app and Calculator test-suite. Alternatively, check out our Espresso sample GitHub repository.

Integrate with Test Observability

Add the gradle plugin and the SDK dependency

Add the gradle plugin under plugins and the BrowserStack SDK dependency under dependencies in the build.gradle file of the app.

build.gradle
Copy icon Copy snippet

Add mavenCentral and the classpath for android tools

Add mavenCentral under buildscript at root level and the classpath for android tools under dependencies in the build.gradle file.

build.gradle
Copy icon Copy snippet

Build the main and the test apk

Use the command that you usually use to build the main and the test apk. Some of the commands generally used are gradle assembleDebug and gradle assembleAndroidTest.

Upload your app

Upload your Android app (.apk or .aab file) to BrowserStack servers using a REST API request.

Use the following sample cURL comman to upload an app:

Terminal
Copy icon Copy snippet

You can refer to the App Automate Espresso guide for more details and a sample request response.

Note: App upload will take a few seconds to about a minute, depending on the size of your app. Do not interrupt the curl command until you get the response back.

Upload your test suite

Upload your Espresso test suite (.apk) file to BrowserStack servers using our REST API.

The following sample cURL command shows how to upload a test suite:

Terminal
Copy icon Copy snippet

You can refer to the App Automate Espresso guide for more details and a sample request response.

Run your test suite

After you upload your app and test suite to BrowserStack servers, send an API request with testObservability parameter set as true and other parameters, to start the test execution as shown in the following sample cURL request:

Terminal
Copy icon Copy snippet

The parameters related to Test Observability in the above sample curl request are the following:

  • project: The project name under which the test will be organized.
  • o11y_buildTags: Any custom build tags (optional) you want to associate with the build.
  • o11y_hostInfo: An optional parameter with information related to the host including the host name.
  • o11y_ciInfo: An optional parameter with information related to the CI build including the name of the CI tool, build URL, job name, and build number.
  • o11y_buildRunIdentifier: An optional custom identifier for the build run. You can merge multiple reports into a single report using this parameter. Learn more.
  • o11y_reRun: Set this to true for re-runs of your suite. By default, this parameter is set to false.

Post build run completion, you will see the build URL of Test Observability in your console. Alternatively, you can also navigate to your build run using Build Runs.

Visit Test Observability

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback!

Talk to an Expert
Download Copy