Multi-module apps
To test your native and hybrid multi-module apps on BrowserStack using Espresso, upload your app and test suite together in the .apk
format to BrowserStack servers.
Upload an app
Upload the .apk
file of your module, which contains your app and test suite, for multi-module testing, by using any of the following options:
- Upload from filesystem : Use this option to upload your module from your local machine or CI/CD server.
- Upload using public URL : Use this option when the module is hosted on a remote server (e.g. S3 bucket), and is downloadable via a publicly accessible URL.
Request parameters
Request
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" \
-
file File
File to upload. Ensure that the request’s content type is set to
multipart/form-data
. In cURL, you can do this using-F
option. Eitherfile
orurl
parameter is required. -
url String
Remote URL to your app. Ensure that its a publicly accessible URL as BrowserStack will attempt to download the app from this location. Either
file
orurl
parameter is required.
Response attributes 200
application/json
Response
{
"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"
}
-
module_name String
Filename of the uploaded module.
-
module_url String
Unique identifier returned upon successful upload of your module on BrowserStack. This value can be used later to specify the module/testSuite for your Espresso test execution.
Example:bs://c8ddcb5649a8280ca800075bfd8f151115bba6b3
-
module_id String
Unique identifier returned upon successful upload of your module on BrowserStack.
Example:c8ddcb5649a8280ca800075bfd8f151115bba6b3
-
uploaded_at String
App upload timestamp.
-
expiry String
By default, an uploaded app expires in 30 days. Upon expiry, the uploaded app is deleted from BrowserStack servers and thus can no longer be tested.
-
framework String
This is a static value used by Browserstack internally to identify multi-module app testing.
Execute a build
Start the execution of a new build on BrowserStack. While making a request, you must specify the test suite, as well as a list of devices to execute your tests on. In addition, you can specify a number of other parameters to customise test execution. Every build has a unique build_id
associated with it. This is returned in the response to this endpoint.
Request parameters
Request
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/espresso/v2/module-build" \
-d '{"testSuite": "bs://89c874f21852ba57957a3fdc33f47514288c4ba1","project" : "Multi-module" "devices": ["Samsung Galaxy S20-10.0","Google Pixel 3-9.0"]}' \
-H "Content-Type: application/json"
-
testSuite* String
Specify the module url. Use
module_url
of a previously uploaded module. This is the value returned when the combined apk is uploaded to Browserstack. -
devices* Array
List of devices to execute your tests on. Learn more about selecting devices
Example:['Samsung Galaxy S8-7.0', 'Google Pixel 3-10.0']
-
shards Object
Split an Espresso test-suite into multiple shards and execute them in parallel.
-
numberOfShards* Integer
The total number of shards to split the test-suite into.
-
deviceSelection String
Specify if a shard should run on all specified devices (using
devices
parameter) or on only one random device.Possible Value Description all
Each shard will run on all specified devices. Thus, the total number of parallel tests required for test execution will be equal to (numberOfShards * number of specified devices). This is default behaviour. any
Each shard will run on any one random device. Thus, the total number of parallel tests required for test execution will be equal to (numberOfShards) -
mapping Array
Details of how test sharding should be handled. Each shard should have its corresponding mapping. This is optional parameter - if mapping is not provided, we will handle test sharding automatically.
-
name* String
Unique identifier for each shard.
Example:0
,1
-
strategy* String
Strategy used to shard. The possible values:
Possible Value Description class
Allows you to define a list of test classes to be executed in a particular shard. package
Allows you to define a list of test packages to be executed in a particular shard. annotation
Allows you to run tests in a shard based on test annotations. size
Allows you to run tests in a shard based on test size annoations (E.g. SmallTest, MediumTest, LargeTest). -
values* Array
Class/Package/Annotation/Size values depending on the type of
strategy
selected.
Example:["com.android.dashboard.Home", "com.android.profile.addUser"]
forclass
strategy.
-
-
-
project String
Unique identifier to logically group multiple builds together. Only letters (A-Z, a-z), digits (0-9), periods (.), colons (:) and underscores (_) are allowed. Any other characters are ignored.
-
class String
Filter test cases by selected classes in the test-suite. Specify a list of fully qualified Java class name(s).
Example:["com.android.foo.ClassA", "com.android.foo.ClassB"]
- Show 26 more
-
package String
Filter test cases by selected packages in the test-suite. Specify a list of fully qualified Java package name(s).
Example:["com.android.foo"]
-
annotation String
Filter test cases by selected annotations in the test-suite. Specify a list of fully qualified annotation(s).
Example:["com.android.foo.MyAnnotation"]
-
size String
Filter test cases of specific test size i.e tests annotated with @SmallTest, @MediumTest or @LargeTest in the test-suite. Specify a list of test size values (small/medium/large).
Example:["small", "medium"]
-
singleRunnerInvocation String
Execute all test cases together with a single test runner invocation. By default, its set to false. Learn more about singleRunnerInvocation API
-
callbackURL String
Specify a callback URL to enable BrowserStack to notify you upon the completion of your build.
-
projectNotifyURL String
Specify a callback URL to enable BrowserStack to notify you upon the completion of all builds under the given project. You will receive a callback if no new builds triggered for 5 mins and all existing builds have finished execution.
Note: Set this parameter along with the
project
parameter. -
networkLogs Boolean
Capture network logs (data such as network traffic, latency, HTTP requests and responses in the HAR format) for your test execution. By default, its set to false.
-
deviceLogs Boolean
Capture device logs (system logs specific to your application generated by Android) for your test execution. By default, its set to false.
-
enableSpoonFramework Boolean
Capture screenshots using the Spoon framework.
-
debugscreenshots Boolean
Capture screenshots using App Automate’s native screenshot feature. Check out the espresso-browserstack sample repository for more details on using the native screenshot feature.
-
video Boolean
Enable or disable video recording for your test execution. By default, its set to true.
-
gpsLocation String
Simulate the location of the device to specific GPS coordinates. Specify latitude followed by longitude. Learn more about gpsLocation API.
Example:40.730610,-73.935242
-
geoLocation String
Test your app behavior from different countries using IP geolocation. Specify the two letter country code. Learn more about geoLocation API.
Example:CN
for China,FR
for France. -
networkProfile String
Simulate different network conditions while testing your app.
Example:2g-gprs-good
,2g-gprs-lossy
. View the list of supported network profiles. -
customNetwork String
Simulate custom network condition while testing your app. Specify download speed (kbps), upload speed (kbps), latency (ms), packet loss (%).
Example:1000, 1000, 100, 1
-
language String
Set the language of the app under test.
Example:fr
(for French) -
locale String
Set locale to test the localized version of your app.
Example:fr_CA
(for French-Canada) -
appStoreConfiguration Object
Set credentials for Google account login. You need to pass:
Possible Value Description username
Username of your Google account password
Password of your Google account Example:
{"username":"xyz@gmail.com","password":"xyz@123"}
-
deviceOrientation Boolean
Set the screen orientation of the mobile device. Specify
portrait
orlandscape
. By default, its set toportrait
. -
acceptInsecureCerts Boolean
Set this parameter to true to avoid invalid certificate errors while using self-signed certificate to test your app. By default, its set to false.
-
uploadMedia Array
Set this parameter if you want to use your uploaded images or videos during test execution. Specify a list of
media_url
for previously uploaded images or video. Learn more about uploadMedia API. -
local Boolean
Enable Local Testing for App Automate. With Local Testing enabled, test apps that retrieve data from servers on your local machine or other private network configurations.
-
localIdentifier Boolean
If you are using the same account to test multiple applications, you can set up a named connection using the
localIdentifier
option. Example:Test123
-
idleTimeout Boolean
Use this parameter to specify the maximum time limit for which your test execution can remain idle. If it exceeds this threshold, your build status will change to timed out. Accepted range of values are between 60 seconds to 900 seconds. By default, its set to 900 seconds.
-
clearPackageData Boolean
Use this parameter to clear app data after every test run. Check out the clear app data guide to learn more.
-
buildTag String
Unique identifier to tag builds. Only letters (A-Z, a-z), digits (0-9), periods (.), colons (:) and underscores (_) are allowed. Any other characters are ignored.
Example:Reg
Response attributes 200
application/json
Response
{
"message": "Success",
"build_id": "5c5ab4338cec13aeb78f7a6977344556ac00bccd6"
}
-
message String
Status of the request.
-
build_id String
A unique identifier for your test execution.
Example:5c5ab4338cec13aeb78f7a6977344556ac00bccd6
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.