This repository demonstrates how to run Appium NodeJS mocha tests on BrowserStack App Automate.
-
Node.js
-
If not installed, install Node.js from here
-
Ensure you have node & npm installed by running
node -v&npm -v
-
For Android tests, run the following command in project's base directory :
cd android
npm install
Or,
For dependencies for iOS tests, run following command in project's base directory :
cd ios
npm i
Getting Started with Appium tests in NodeJS mocha on BrowserStack couldn't be easier!
1. Upoad your Android or iOS App
Upload your Android app (.apk or .aab file) or iOS app (.ipa file) to BrowserStack servers using our REST API. Here is an example cURL request :
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/upload" \
-F "file=@/path/to/apk/file"
Ensure that @ symbol is prepended to the file path in the above request. Please note the app_url value returned in the API response. We will use this to set the application under test while configuring the test later on.
Note: If you do not have an .apk or .ipa file and are looking to simply try App Automate, you can download and test using our sample Android app or sample iOS app.
2. Configure and run your first test
Open single.conf.js file in Android or in ios folder
-
Replace
YOUR_USERNAME&YOUR_ACCESS_KEYwith your BrowserStack access credentials. Get your BrowserStack access credentials from here -
Replace
bs://<app-id>wkth the URL obtained from app upload step -
Set the device and OS version
-
If you have uploaded your own app update the test case
-
Run
npm run singlefrom android or ios folder -
You can access the test execution results, and debugging information such as video recording, network logs on App Automate dashboard
1. Upload your Android or iOS App
Upload your Android app (.apk or .aab file) or iOS app (.ipa file) that access resources hosted on your internal or test environments to BrowserStack servers using our REST API. Here is an example cURL request :
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/upload" \
-F "file=@/path/to/apk/file"
Ensure that @ symbol is prepended to the file path in the above request. Please note the app_url value returned in the API response. We will use this to set the application under test while configuring the test later on.
Note: If you do not have an .apk or .ipa file and are looking to simply try App Automate, you can download and test using our sample Android Local app or sample iOS Local app.
2. Configure and run your local tes
Open local.conf.js file in Android or in ios folder
-
Replace
YOUR_USERNAME&YOUR_ACCESS_KEYwith your BrowserStack access credentials. Get your BrowserStack access credentials from here -
Replace
bs://<app-id>wkth the URL obtained from app upload step -
Set the device and OS version
-
Ensure that
localcapability is set totrue. Within the test script, there is code snippet that automatically establishes Local Testing connection to BrowserStack servers using Javascript binding for BrowserStack Local. -
If you have uploaded your own app update the test case
-
Run
npm run localfrom android or ios folder -
You can access the test execution results, and debugging information such as video recording, network logs on App Automate dashboard
3. Speed up test execution with parallel testing :
Open parallel.conf.js file in Android or in ios folder
-
Replace
YOUR_USERNAME&YOUR_ACCESS_KEYwith your BrowserStack access credentials. Get your BrowserStack access credentials from here -
Add multiple configurations under multiCapabilities
-
Replace
bs://<app-id>with the URL obtained from app upload step to all configurations -
Set the device and OS version to all the configuration
-
If you have uploaded your own app update the test case
-
Run
npm run parallelfrom android or ios folder -
You can access the test execution results, and debugging information such as video recording, network logs on App Automate dashboard
For other NodeJS frameworks samples, refer to following repositories :
Note: For other test frameworks supported by App-Automate refer our Developer documentation
If you are running into any issues or have any queries, please check Browserstack Support page or get in touch with us.