Skip to main content

Appium with Nightwatch

Your guide to running tests using Nightwatch on BrowserStack’s Appium Grid of 3000+ real devices.

Run tests on 3000+ real devices and desktop browsers

Prerequisites

  • BrowserStack username and access key, which you can find in your profile settings. If you have not created an account yet, you can sign up for a free trial.
  • Node.js 14+ installed on your system. You can download the updated Node version from nodejs.org.

Run a sample build

Here’s how you can run a sample Nightwatch test build in three steps on BrowserStack:

Step 1. Clone the sample repository

Clone our sample repository and install the dependencies. You need a development environment with Node 14+.

git clone https://github.com/BrowserStackCE/browserstack-examples-nightwatchjs-appium
cd browserstack-examples-nightwatchjs-appium/
npm install

Step 2. Set access credentials

Set userName and accessKey parameters using environment variables to authenticate your tests.

export BROWSERSTACK_USERNAME="username"
export BROWSERSTACK_ACCESS_KEY="accesskey"
$env:BROWSERSTACK_USERNAME="YOUR_USERNAME"
$env:BROWSERSTACK_ACCESS_KEY="YOUR_ACCESS_KEY"
setx BROWSERSTACK_USERNAME "username" 
setx BROWSERSTACK_ACCESS_KEY "accesskey"
set BROWSERSTACK_USERNAME=username
set BROWSERSTACK_ACCESS_KEY=accesskey

Step 3. Execute the build on BrowserStack

You are now ready to run your build on BrowserStack. From the root directory of this project, run one of the following commands according to your requirement.

Requirement Command
Run a single android test npm run single-android
Run a single iOS test npm run single-ios
Run local tests npm run local

Please run the above tests once before running parallel tests, so that the apps can be uploaded on the respective custom id.

Requirement Command
Run parallel tests npm run parallel
Run parallel tests on different devices npm run parallel-devices
Run the test suite npm run suite
Run parallel local tests npm run parallel-local

Next Steps

Once you have successfully run the sample test on BrowserStack, you might want to check the following:

Need some help?

If you have any queries, please get in touch with us.

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