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 profile. 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 SpecFlow tests for Local Testing.
-
Clone the specflow-browserstack repository on GitHub that contains BrowserStack’s sample test, if you haven’t already done so:
git clone -b selenium-3 https://github.com/browserstack/specflow-browserstack
-
Open the
Specflow-BrowserStack.sln
solution file in Visual Studio. -
Update your SpecFlow
App.config
config file by setting your credentials and setting thebrowserstack.local
capability totrue
.<?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 specflow" /> <add key="local" value="true" /> </local> </capabilities> <environments> <chrome> <add key="browser" value="chrome" /> </chrome> </environments> </configuration>
-
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"
-
You can now run your SpecFlow test using BrowserStack Local with the following steps:
- Build the solution in Visual Studio.
- 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:
- Run multiple tests in parallel to speed up the build execution
- Testing your local site that might be behind a proxy
- Local flags to customize your local testing setup
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
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!