Run Appium tests using Node.js | BrowserStack Docs
Run Appium tests using Node.js
Run your Appium tests written in Node.js on real Android and iOS devices with BrowserStack App Automate.
Your guide to running tests using NodeJS on BrowserStack’s Appium Grid of 3000+ real devices.
In this document, you’ll learn how to set up your Node Appium testing environment, configure your test settings, and execute your first automated test on BrowserStack’s real device cloud. We’ll walk you through each step, from initial setup to viewing your test results on the dashboard.
Onboard faster with Test Companion
Launch in your IDE. Chat with the AI assistant to configure and run your first build instantly.
Prerequisites
- You need to have BrowserStack Username and Access key, which you can find in your account profile. If you have not created an account yet, you can sign up for a Free Trial
- Node v16.20.1+ installed on your machine.
Run a sample build
Run a sample NodeJS test build using the following steps:
Get our sample project
Get our sample project using one of the following options.
Option 1: Download the project
Option 2: Clone the sample repository
Clone our sample repository and navigate to the root folder.
git clone https://github.com/browserstack/node-appium-app-browserstack
cd node-appium-app-browserstack
Configure the config file
Configure a few parameters in the browserstack.yml config file to run the sample build.
Set access credentials
Use the userName and accessKey variables to set your BrowserStack access credentials in the browserstack.yml file to authenticate your tests.
Configure browser or device combinations
Use one of our sample apps to run your first Appium test on BrowserStack App Automate. Choose from the options below:
Platform
Select an OS to choose the devices from below
Android
Parallel thread
#1
Samsung
Samsung Galaxy S22 Ultra 12.0
Parallel thread
#2
Google
Google Pixel 8 Pro 14.0
Parallel thread
#3
Oneplus
OnePlus 11R 13.0
Copy and replace the browserstack.yml config file
Replace the contents of browserstack.yml situated in the root directory of this project with the given config.
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
app: YOUR_APP_ID
platforms:
- YOUR_FIRST_OS_TYPE: YOUR_FIRST_OS
YOUR_FIRST_BROWSER_TYPE: YOUR_FIRST_BROWSER
YOUR_FIRST_BROWSER_VERSION_TYPE: "YOUR_FIRST_BROWSER_VERSION"
- YOUR_SECOND_OS_TYPE: YOUR_SECOND_OS
YOUR_SECOND_BROWSER_TYPE: YOUR_SECOND_BROWSER
YOUR_SECOND_BROWSER_VERSION_TYPE: "YOUR_SECOND_BROWSER_VERSION"
- YOUR_THIRD_OS_TYPE: YOUR_THIRD_OS
YOUR_THIRD_BROWSER_TYPE: YOUR_THIRD_BROWSER
YOUR_THIRD_BROWSER_VERSION_TYPE: "YOUR_THIRD_BROWSER_VERSION"
browserstackLocal: true
buildName: browserstack-build-1
projectName: BrowserStack Sample
Execute the build on BrowserStack
Based on the devices and app selected, navigate to the right project, install dependencies, and run a sample test build on BrowserStack
cd android
npm install
npm run sample-test
cd ios
npm install
npm run sample-test
If a test run stops due to a crash, you can stop the build from running by clicking the Stop build option from the App Automate dashboard.
After you have successfully run your first test on BrowserStack, try integrating your test suite with BrowserStack.