{"id":51528769,"url":"https://github.com/browserstack/nunit-playwright-browserstack","last_synced_at":"2026-07-09T00:31:50.595Z","repository":{"id":358876561,"uuid":"1231634275","full_name":"browserstack/nunit-playwright-browserstack","owner":"browserstack","description":"Sample repo for customers","archived":false,"fork":false,"pushed_at":"2026-06-15T14:23:39.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-15T16:17:26.636Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/browserstack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-07T06:28:52.000Z","updated_at":"2026-06-15T14:24:04.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/browserstack/nunit-playwright-browserstack","commit_stats":null,"previous_names":["browserstack/nunit-playwright-browserstack"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/browserstack/nunit-playwright-browserstack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserstack%2Fnunit-playwright-browserstack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserstack%2Fnunit-playwright-browserstack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserstack%2Fnunit-playwright-browserstack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserstack%2Fnunit-playwright-browserstack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/browserstack","download_url":"https://codeload.github.com/browserstack/nunit-playwright-browserstack/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserstack%2Fnunit-playwright-browserstack/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35282897,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-08T02:00:06.796Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-07-09T00:31:49.954Z","updated_at":"2026-07-09T00:31:50.555Z","avatar_url":"https://github.com/browserstack.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nunit-playwright-browserstack\n\nThis sample shows how to run [NUnit](https://nunit.org/) + [Playwright](https://playwright.dev/dotnet) tests on BrowserStack using the [BrowserStack .NET SDK](https://www.nuget.org/packages/BrowserStack.TestAdapter). The SDK reads `browserstack.yml`, fans your tests out across the platforms listed there, starts and stops BrowserStack Local automatically, and reports test status to the BrowserStack dashboard. Your test code stays pure `Microsoft.Playwright` + NUnit -- no manual `ConnectAsync`, no caps in code.\n\n![BrowserStack Logo](https://d98b8t1nnulk5.cloudfront.net/production/images/layout/logo-header.png?1469004780)\n\n## Run Sample Build\n\n* Clone the repo\n* Open the solution `NunitPlaywrightBrowserstack.sln` in Visual Studio (or your IDE of choice)\n* Build the solution (`dotnet build`)\n* Replace the `userName` and `accessKey` placeholders in `browserstack.yml` with your [BrowserStack Username and Access Key](https://www.browserstack.com/accounts/settings). Alternatively, remove those two lines from the yml and set `BROWSERSTACK_USERNAME` and `BROWSERSTACK_ACCESS_KEY` as environment variables -- the SDK falls back to env vars only when the yml fields are absent\n\n### Running your tests from CLI\n\n```sh\ncd NunitPlaywrightBrowserstack.Tests\ndotnet test --filter \"Category=sample-test\"\n```\n\nThe sample runs `BStackDemoCartTest` across all four platforms declared in `browserstack.yml` (Windows 11 / Chrome, macOS / WebKit, Windows 11 / Firefox, Windows 11 / Edge) in parallel.\n\nUnderstand how many parallel sessions you need by using our [Parallel Test Calculator](https://www.browserstack.com/automate/parallel-calculator?ref=github).\n\n### Testing a private host (BrowserStack Local)\n\nIf your app lives on `localhost`, a staging host, or behind a firewall, run the local fixture (`browserstackLocal: true` is already set in `browserstack.yml`):\n\n```sh\n# 1. Stand up a tiny static page locally on port 45454 (any HTTP server works)\nmkdir -p bs-local-harness \u0026\u0026 cd bs-local-harness\ncat \u003e index.html \u003c\u003c'HTML'\n\u003c!doctype html\u003e\n\u003chtml\u003e\u003chead\u003e\u003ctitle\u003eBrowserStack Local Test\u003c/title\u003e\u003c/head\u003e\n\u003cbody\u003eOK\u003c/body\u003e\u003c/html\u003e\nHTML\npython3 -m http.server 45454 \u0026\n\n# 2. Run the local fixture\ncd ../NunitPlaywrightBrowserstack.Tests\ndotnet test --filter \"Category=sample-local-test\"\n```\n\nThe SDK starts and stops the BrowserStack Local tunnel for you -- no manual binary download or lifecycle management. The cloud browser reaches your local server through `http://bs-local.com:\u003cport\u003e/`.\n\n## Integrate your test suite\n\nThis repository uses the BrowserStack SDK to run tests on BrowserStack. To wire the SDK into your own test suite:\n\n* Create a `browserstack.yml` at the project root with your BrowserStack credentials and platform list (see this repo for a working template)\n* Add the `BrowserStack.TestAdapter` NuGet package:\n\n  ```sh\n  dotnet add package BrowserStack.TestAdapter\n  ```\n\n* Build the project (`dotnet build`); the SDK installs the `browserstack-sdk` dotnet tool and patches the test assembly so Playwright launches are routed to BrowserStack at runtime\n\n## How the SDK changes things\n\n- **One `browserstack.yml`** declares platforms, parallelism, the Local toggle, and reporting; the SDK picks them up automatically\n- **The SDK runs platforms in parallel for you** -- one NUnit run per `(platform x parallelsPerPlatform)` cell, no per-platform branching needed\n- **The SDK rewrites Playwright launches** -- `PlaywrightFixtureBase.cs` calls `pw.Chromium.LaunchAsync()` and the SDK transparently redirects to the per-platform browser configured in the yml (`chrome` / `playwright-webkit` / `playwright-firefox` / `edge`). No `Chromium.ConnectAsync(wss_url)` plumbing\n- **The SDK starts and stops BrowserStack Local** when `browserstackLocal: true` -- no manual tunnel lifecycle management\n\n## Parallelism: SDK fan-out x NUnit\n\nThis sample stacks two layers of parallelism:\n\n| Layer | Configured in | Effect |\n|---|---|---|\n| SDK platform fan-out | `browserstack.yml` -\u003e `platforms` + `parallelsPerPlatform` | The SDK spawns one NUnit run per `(platform x parallelsPerPlatform)` cell |\n| NUnit fixture-level parallelism | `AssemblyInfo.cs` -\u003e `[assembly: Parallelizable(ParallelScope.Fixtures)]` | Within each NUnit run, `[TestFixture]` classes execute concurrently |\n\nWith the shipped defaults (4 platforms x `parallelsPerPlatform: 1`, 2 fixtures: `BStackDemoCartTest` + `BStackLocalSampleTest` running in parallel via NUnit), a single `dotnet test` produces **up to 8 concurrent BrowserStack sessions**. Tune `parallelsPerPlatform` and `LevelOfParallelism` in `AssemblyInfo.cs` to match your BrowserStack plan.\n\n## Repo layout\n\n```\n.\n├── NunitPlaywrightBrowserstack.sln\n└── NunitPlaywrightBrowserstack.Tests/\n    ├── NunitPlaywrightBrowserstack.Tests.csproj\n    ├── browserstack.yml             # SDK config: credentials, 4 platforms, Local toggle, reporting\n    ├── AssemblyInfo.cs              # NUnit fixture-level parallelism\n    ├── PlaywrightFixtureBase.cs     # [SetUp]/[TearDown] managing IPage; SDK routes the launch\n    ├── BStackDemoCartTest.cs        # bstackdemo add-to-cart scenario\n    └── BStackLocalSampleTest.cs     # BrowserStack Local + bs-local.com:45454 scenario\n```\n\n## Notes\n\n* You can view your test results on the [BrowserStack Automate dashboard](https://www.browserstack.com/automate)\n* To test on a different set of browsers, see our [list of supported browsers and platforms](https://www.browserstack.com/list-of-browsers-and-platforms?product=automate)\n* You can export the environment variables for the Username and Access Key of your BrowserStack account:\n\n  * For Unix-like or Mac machines:\n  ```sh\n  export BROWSERSTACK_USERNAME=\u003cbrowserstack-username\u003e \u0026\u0026\n  export BROWSERSTACK_ACCESS_KEY=\u003cbrowserstack-access-key\u003e\n  ```\n  * For Windows Cmd:\n  ```cmd\n  set BROWSERSTACK_USERNAME=\u003cbrowserstack-username\u003e\n  set BROWSERSTACK_ACCESS_KEY=\u003cbrowserstack-access-key\u003e\n  ```\n  * For Windows Powershell:\n  ```powershell\n  $env:BROWSERSTACK_USERNAME=\u003cbrowserstack-username\u003e\n  $env:BROWSERSTACK_ACCESS_KEY=\u003cbrowserstack-access-key\u003e\n  ```\n\n## Further Reading\n\n- [NUnit](https://nunit.org/)\n- [Playwright .NET](https://playwright.dev/dotnet/)\n- [BrowserStack documentation for Playwright in C#](https://www.browserstack.com/docs/automate/playwright/getting-started/c-sharp)\n- [BrowserStack.TestAdapter on NuGet](https://www.nuget.org/packages/BrowserStack.TestAdapter)\n- [xUnit + Reqnroll reference sample](https://github.com/browserstack/xunit-reqnroll-playwright-browserstack)\n- [Original C# Playwright reference sample](https://github.com/browserstack/csharp-playwright-browserstack)\n\nHappy Testing!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrowserstack%2Fnunit-playwright-browserstack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrowserstack%2Fnunit-playwright-browserstack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrowserstack%2Fnunit-playwright-browserstack/lists"}