Skip to main content

Test your apps with API servers locally staged with Browserstack

BrowserStack can integrate with test suites and app pointing to your local API server. This is done using BrowserStack Local - a tunneling feature that establishes a secure connection between your device and the BrowserStack Cloud.

Select your integration method

  • BrowserStack SDK (Recommended)
    Plug-n-play solution that takes care of all the integration steps for you
  • Legacy (Language bindings)
    Start and stop the BrowserStack Local tunnel within your test suite manually

Using the BrowserStack SDK is the recommended integration method for Nodejs. The SDK auto-handles your integration steps.

Learn the benefits of using BrowserStack SDK

Following are the benefits of using BrowserStack SDK against manual integration process:

Integration step With BrowserStack SDK With manual integration
Perform Appium Driver changes to run tests on BrowserStack Yes Via the browserstack.yml config file Changes Requires code changes to change the Remote Appium Driver
Integrate with BrowserStack Local Yes Via the browserstack.yml config file Changes Requires code changes in test suite
Send test context to BrowserStack for reporting Changes Requires code changes in test suite Changes Requires additional code to be added in the test suite hooks
Test on multiple devices using parallelization Yes Via the browserstack.yml config file Changes May require code changes depending on the test suite
Use advanced parallelization strategies Changes Requires code changes to support different parallelisation strategies Changes Requires code changes to support different parallelization strategies

* Depending on your test framework


Prerequisites

Configure BrowserStack Local

Once you have installed the BrowserStack SDK, ensure the browserstackLocal property is set to true in your browserstack.yml config file. You can now test your local apps on BrowserStack.

browserstack.yml
Copy icon Copy snippet

Check connectivity

Run this sample test to check if BrowserStack Local is working as expected and can connect to BrowserStack servers.

Clone sample git repository

Clone the sample node-appium-app-browserstack repository using the following command:

Copy icon Copy snippet

Set BrowserStack credentials

Set userName and accessKey in the browserstack.yml config file. Skip this step if you have already set credentials as env variables.

browserstack.yml
Copy icon Copy snippet

Set path to local sample app

Set app value as path to your Android (.apk and .aab) or iOS(.ipa) file in browserstack.yml config file. The path value can be relative or absolute.

browserstack.yml
Copy icon Copy snippet
Note: Check out how to create IPA files for iOS app testing on BrowserStack.

Execute build on BrowserStack

Based on the devices and app selected, cd to the right project, install the dependencies, and run the following command:

Copy icon Copy snippet
Copy icon Copy snippet

If the status check fails, refer to the sections below for additional configuration that may be needed.

Additional configuration

BrowserStack Local works out of the box in most cases, but depending on the API servers being tested and your network configuration, additional configuration may be required. Here are the most frequently occurring scenarios:

The API servers you’re testing are accessible via the internet, but they serve different content within your internal network.

This is common with staging environments set up as sub-domains and configured to work only in your private/VPN network. In this case, add the following entry in your browserstack.yml file.

browserstack.yml
Copy icon Copy snippet

The forceLocal capability will resolve all network traffic through the BrowserStack Local tunnel.

Bypass invalid certificate warnings

To avoid invalid certificate errors while testing, set the acceptInsecureCerts capability at the root level in your browserstack.yml file.

browserstack.yml
Copy icon Copy snippet

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