Test on Internal Networks

Run MBUnit tests on your privately hosted websites using BrowserStack Automate

BrowserStack enables you to run your MBUnit 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.

Note: Code samples in this guide can be found in the mbunit-browserstack sample repo on GitHub

Configuring your MBUnit tests for Local Testing takes just few simple steps:

  1. Download and install the BrowserStack Local binary using NuGet Gallery:

  2. Next, you need to update your MBUnit config file, App.config, and set the browserstack.local capability to true:

     <?xml version="1.0" encoding="utf-8" ?>
     <configuration>
       <configSections>
         <sectionGroup name="capabilities">
           <section name="local" type="System.Configuration.AppSettingsSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
         </sectionGroup>
    
         <sectionGroup name="environments">
           <section name="chrome" type="System.Configuration.AppSettingsSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
         </sectionGroup>
       </configSections>
    
       <appSettings>
         <add key="user" value="YOUR_USERNAME" />
         <add key="key" value="YOUR_ACCESS_KEY" />
         <add key="server" value="hub-cloud.browserstack.com" />
       </appSettings>
    
       <capabilities>
         <local>
           <add key="browserstack.local" value="true" />
         </local>
       </capabilities>
    
       <environments>
         <chrome>
           <add key="browser" value="chrome" />
         </chrome>
       </environments>
     </configuration>
    
  3. Run a sample test case to check whether the Local test connection has been set up properly. You can use the following sample test case, which can be found in the repo under mbunit-browserstack/MBUnit-BrowserStack/ directory:

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

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

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