Skip to main content
Transform your testing process with: Real Device Features, Company-wide Licences, & App Percy

Upload your modules

To test your multi-module apps, upload the module(which has both your app and testSuite bundled together as a .apk file) to BrowserStack. There are multiple ways to achieve this, which are mentioned below.

Upload module from filesystem

In order to test your multi-module apps on BrowserStack, upload your module to BrowserStack servers. Its easy to upload an Android app and test suite bundled together(.apk file) from your local filesystem or CI/CD server to BrowserStack using the REST API.

Here is an example cURL request to upload an Android app :

curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/espresso/v2/module-app" \
-F "file=@/path/to/app/file/application-module.apk"

A sample response to the above API request is shown below :

{
    "module_name": "application-module.apk",
    "module_url": "bs://c8ddcb5649a8280ca800075bfd8f151115bba6b3",
    "module_id": "c8ddcb5649a8280ca800075bfd8f151115bba6b3",
    "uploaded_at": "2020-05-05 14:52:54 UTC",
    "expiry" : "2020-06-05 14:52:54 UTC",
    "framework": "module"
}

Please note the value of module_url in the API response (bs://c8ddcb5649a8280ca800075bfd8f151115bba6b3 in the above example). This value will be used later to specify the testSuite for your multi-module test execution.

Note:
  1. 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.
  2. If you upload an unsigned version of the Android app, we sign them with our certificates before installing them to our devices. When BrowserStack resigns the apps, your app’s integration with third-party libraries such as Google Firebase services, Google Maps SDK, Facebook SDK, etc. may not work if you have restricted the use of API keys based on the SHA-1 certificate fingerprint of the app’s signing key. To avoid this issue, you can sign the APK with your own certificates before uploading the app to BrowserStack.

Upload module using public URL

Upload your multi-module app and test suite bundled together (.apk file) from a public URL to BrowserStack using the REST API. This approach is useful when the module is hosted on a remote server (e.g. S3 bucket) and is downloadable via a publicly accessible URL.

Here is an example cURL request to upload an Android module using a public URL :

curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/espresso/v2/module-app" \
-F "url=https://www.browserstack.com/app-automate/sample-modules/android/Calculator-module.apk"

A sample response to the above API request is shown below :

{
    {
    "module_name": "Calculator-module.apk",
    "module_url": "bs://c8ddcb5649a8280ca800075bfd8f151115bba6b3",
    "module_id": "c8ddcb5649a8280ca800075bfd8f151115bba6b3",
    "uploaded_at": "2020-05-05 14:52:54 UTC",
    "expiry" : "2020-06-05 14:52:54 UTC",
    "framework": "module"
}
}

Please note the value of module_url in the API response (bs://c8ddcb5649a8280ca800075bfd8f151115bba6b3 in the above example). This value will be used later to specify the testSuite for your Espresso test execution.

Note:
  1. 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.
  2. If you upload an unsigned version of the Android app, we sign them with our certificates before installing them to our devices. When BrowserStack resigns the apps, your app’s integration with third-party libraries such as Google Firebase services, Google Maps SDK, Facebook SDK, etc. may not work if you have restricted the use of API keys based on the SHA-1 certificate fingerprint of the app’s signing key. To avoid this issue, you can sign the APK with your own certificates before uploading the app to BrowserStack.

Define custom ID for app

On every module upload, a new value for module_url is generated. Use this value to execute your multi-module tests with the latest build of the module.

If you want to use a constant value to specify the module and don’t want to modify your scripts after every build upload, you can define a custom ID for your module. Use the same custom ID every time you upload a new build of the module. Here is an example cURL request to upload an Android module with the custom ID defined as poc_app :

curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/espresso/v2/module-app" \
-F "file=@/path/to/app/file/Application-module.apk" \
-F "custom_id=poc_app"
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/espresso/v2/module-app" \
-F "url=https://www.browserstack.com/app-automate/sample-apps/android/Application-module.apk" \
-F "custom_id=poc_app"

A sample response to the above API request is shown below :

 {
    "module_url":"bs://f7c874f21852ba57957a3fdc33f47514288c4ba4", 
    "custom_id":"poc_app",
    "shareable_id":"exampleuser/poc_app"
 }

While executing your Espresso tests, simply use the custom_id value (poc_app in the above example) to specify the testSuite. The test execution will pick the last uploaded build corresponding to that custom ID.

  • Other users in your team can test an app uploaded by you. They need to use the shareable_id value to specify the application under test while setting the app capability in their tests.
  • The use of custom ID or shareable ID is optional.
  • The maximum character limit in the custom_id parameter is 100 and the characters allowed are a-z, A-Z, 0-9, period(.), underscore(_), and hyphen(-).

A sample request to execute the build using custom_id :

curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/espresso/v2/module-build" \
-d '{"devices": ["Google Pixel 3-9.0"], "testSuite": "poc_app"}'

A sample response for the above request looks like below:

{
    "message": "Success",
    "build_id": "0299dd041483f149c71e6e7f1a0ff34378fac926"
}

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