Skip to main content

Test localhost and staging websites that are not publicly accessible

BrowserStack can integrate with test suites pointing to your localhost URL, staging environment, and even websites behind one or more proxies/firewalls. This is done using BrowserStack Local - a tunneling feature that establishes a secure connection between your machine and the BrowserStack Cloud.

Prerequisites

BrowserStack Username and Access key. You can find this in your account profile. If you do not have an account yet, you can sign up for a Free Trial or purchase a plan.

Run your Local test

Follow the steps to configure and run your xUnit tests for Local Testing.

  1. Clone the xunit-browserstack repository on GitHub that contains BrowserStack’s sample test, if you haven’t already done so:

     git clone -b selenium-4 https://github.com/browserstack/xunit-browserstack.git
    
  2. Open the XUnit-BrowserStack.sln solution file in Visual Studio.

  3. Update your xUnit App.config file by setting your credentials and by setting the local capability to true.

App.config
Copy icon Copy snippet
  1. Run a sample test case using the following command, to check whether the Local test connection has been setup properly.

     dotnet test --filter "Category=local"
    
  2. You can now run your xUnit test using BrowserStack Local using the following steps:

    1. Build the solution in Visual Studio.
    2. Run the test with fixture local from Test Explorer.

Next steps

After you have successfully run your first test using BrowserStack Local, you can explore the following sections:

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