Skip to content

Baaryan/MSTest-playwright-browserstack

 
 

Repository files navigation

MSTest-playwright-browserstack

This sample elaborates the MSTest Integration with BrowserStack.

To perform tests using SDK, please checkout the sdk branch

Setup

Installation Steps

  1. Clone the repository.
  2. Open the solution MSTest-Playwright-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 *.conf.json files in the project.

    {
        "user": "BROWSERSTACK_USERNAME",
        "key": "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

  • You can view your test results on the BrowserStack automate dashboard

  • To test on a different set of browsers, check out our 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>
    

Additional Resources

About

Sample code for running sessions with MStest Playwright on Browserstack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%