Skip to content

Sample code for running sessions with MStest on Browserstack

Notifications You must be signed in to change notification settings

Baaryan/MSTest-browserstack

 
 

Repository files navigation

MSTest-browserstack

Sample code for running sessions with MStest on Browserstack using Selenium 4.

To perform tests using Selenium 3, please checkout the selenium 3 branch

To perform tests using SDK, please checkout the sdk branch

MSTest Integration with BrowserStack.

Setup

Installation Steps

  1. Clone the repository.

  2. Open the solution MSTest-BrowserStack.sln in Visual Studio.

  3. Install dependencies using NuGet Package Manager:

    dotnet restore
  4. Build the solution

Adding Credentials

  1. Add your BrowserStack Username and Access Key to the secrets.json file in the project. You can follow this guide to learn how to manage secrets.

    {
      "BrowserStackUsername": "your-browserstack-username",
      "BrowserStackAccessKey": "your-browserstack-access-key"
    }
  2. Alternatively, you can set environment variables:

    • BROWSERSTACK_USERNAME
    • BROWSERSTACK_ACCESS_KEY

You can get your browserstack credentials from here

Running Tests

  • 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 tests in parallel, execute the following command:

    dotnet test --filter TestCategory=sample-parallel-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

Notes

  • View your test results on the BrowserStack automate dashboard.

  • For testing on different browsers, check the platform configurator.

  • Export the environment variables for BrowserStack credentials:

    export BROWSERSTACK_USERNAME=<browserstack-username> &&
    export BROWSERSTACK_ACCESS_KEY=<browserstack-access-key>

Additional Resources

About

Sample code for running sessions with MStest on Browserstack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%