Sample code for running sessions with MStest on Browserstack using SDK.
To perform tests using Selenium 3, please checkout the selenium 3 branch
To perform tests using Selenium 4, please checkout the main branch
MSTest Integration with BrowserStack.
- Clone the repository.
- Open the solution
MSTest_browserstack.sln
in Visual Studio. - Install dependencies using NuGet Package Manager:
dotnet restore
- To run tests on private websites,
- set
browserstackLocal
:true
atbrowserstack.yml
- set
- Build the solution
-
To run tests, execute the following command:
dotnet test
-
To run the single test, execute the following command:
dotnet test --filter TestCategory=sample-test
-
To run local tests, execute the following command:
dotnet test --filter TestCategory=sample-local-test
Understand how many parallel sessions you need by using our Parallel Test Calculator
This repository uses the BrowserStack SDK to run tests on BrowserStack. Follow the steps below to install the SDK in your test suite and run tests on BrowserStack:
- Create sample browserstack.yml file with the browserstack related capabilities with your BrowserStack Username and Access Key and place it in your root folder.
- Add nuget library BrowserStack.TestAdapter
dotnet add BrowserStack.TestAdapter
- Build project
dotnet build
-
View your test results on the BrowserStack automate dashboard.
-
For testing on different browsers, check the platform configurator.
-
You can export the environment variables for the Username and Access Key of your BrowserStack account
- For Unix-like or Mac machines:
export BROWSERSTACK_USERNAME=<browserstack-username> && export BROWSERSTACK_ACCESS_KEY=<browserstack-access-key>
- For Windows Cmd:
set BROWSERSTACK_USERNAME=<browserstack-username> set BROWSERSTACK_ACCESS_KEY=<browserstack-access-key>
- For Windows Powershell:
$env:BROWSERSTACK_USERNAME=<browserstack-username> $env:BROWSERSTACK_ACCESS_KEY=<browserstack-access-key>