Skip to main content
Introducing the Automate SDK! Get your entire test suite running on BrowserStack in minutes! Learn More.

Test on Internal Networks

BrowserStack enables you to run your PNUnit automated tests on your internal development environments, on localhost, and from behind a corporate firewall. This feature is called “Local Testing”.

Local Testing establishes a secure connection between your machine and the BrowserStack cloud. Once you set up Local Testing, all URLs work out of the box, including HTTPS URLs and those behind a proxy or firewall.

Configuring your PNUnit tests for Local Testing takes just three steps:

  1. Download and install the BrowserStackLocal binary:

    Note: Install BrowserstackLocal using NuGet Gallery.

  2. Next, you need to update your PNUnit config file, local.conf.json, and set the browserstack.local capability to true:

    // config.xml
    <TestGroup>
      <ParallelTests>
          <ParallelTest>
            <Name>PNUnit-BrowserStack</Name>
            <Tests>
              <TestConf>
                <Name>local_test</Name>
                <Assembly>PNUnit-BrowserStack\bin\Release\PNUnit-BrowserStack.dll</Assembly>
                <TestToRun>BrowserStack.LocalTest.HealthCheck</TestToRun>
                <Machine>localhost:8080</Machine>
                <TestParams>
                  <string>local</string>
                  <string>chrome</string>
                </TestParams>
              </TestConf>
            </Tests>
          </ParallelTest>
      </ParallelTests>
    </TestGroup>
    

    Here is a sample test case written for running local with PNUnit.

    public class LocalTest : BrowserStackPNUnitTest
    {
      [Test]
      public void HealthCheck()
      {
        driver.Navigate().GoToUrl("http://bs-local.com:45691/check");
        Assert.IsTrue(Regex.IsMatch(driver.PageSource, "Up and running", RegexOptions.IgnoreCase));
      }
    }
    
  3. You can now run your PNUnit test using BrowserStack Local with the following command:

    Run PNUnit agent start pnunit-agent.exe agent.conf Build the solution in Visual Studio Run test pnunit-launcher.exe config\local.config.xml

    
    

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
Talk to an Expert