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

You need to have the BrowserStack Username and Access key, which you can find in your account summary. If you have not created 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 NUnit tests for Local Testing.

  1. Clone the nunit-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/nunit-browserstack.git
    
  2. Open the NUnit-BrowserStack.sln solution file in Visual Studio.

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

       <?xml version="1.0" encoding="utf-8" ?>
       <configuration>
       <appSettings>
       <add key="user" value="YOUR_USERNAME" />
       <add key="key" value="YOUR_ACCESS_KEY" />
       <add key="server" value="hub.browserstack.com" />
       </appSettings>
    
       <capabilities>
       <local>
         <add key="buildName" value="browserstack-build-1" />
         <add key="sessionName" value="BStack parallel nunit" />
         <add key="local" value="true" />
    
       </local>
       </capabilities>
    
       <environments>
       <chrome>
         <add key="browser" value="chrome" />  
       </chrome>
       </environments>
       </configuration>
     
    
  4. 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"
    
  5. You can now run your NUnit test using BrowserStack Local with the following steps:

    1. Build the solution in Visual Studio.
    2. Run 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