Skip to content

Infra: Migrate test framework from xUnit to NUnit (#71)#73

Closed
kblok wants to merge 1 commit intomainfrom
feature-parity-71
Closed

Infra: Migrate test framework from xUnit to NUnit (#71)#73
kblok wants to merge 1 commit intomainfrom
feature-parity-71

Conversation

@kblok
Copy link
Member

@kblok kblok commented Mar 18, 2026

Summary

  • Created Playwright.Nunit project (net10.0, NUnit 4.1.0) with PlaywrightTestAttribute including IsChromium/IsFirefox/IsWebkit properties driven by PRODUCT env var
  • Replaced xUnit packages with NUnit 4.1.0, NUnit3TestAdapter 4.6.0, NUnit.Analyzers 4.3.0 in test project
  • Rewrote base test classes to use NUnit [SetUp]/[TearDown]/[SetUpFixture] instead of xUnit IAsyncLifetime/ICollectionFixture
  • Bulk-migrated ~130 test files: removed constructors accepting ITestOutputHelper, [Collection] attributes, converted [Fact] to [Test], [Fact(Skip=...)] to [Test, Ignore(...)], [Theory]/[InlineData] to [TestCase]
  • Converted ~2500 xUnit assertions to NUnit constraint model (Assert.That with Is.EqualTo, Does.Contain, Is.True, etc.)
  • Deleted xUnit infrastructure files (custom test framework, xunit.runner.json, XunitLogger)
  • Added [assembly: NonParallelizable] for test execution safety

Closes #71

Test plan

  • dotnet build ./src/Playwright.sln passes with 0 errors
  • Verify test discovery: dotnet test --list-tests
  • Run a subset of tests to confirm execution works

🤖 Generated with Claude Code

- Create Playwright.Nunit project with PlaywrightTestAttribute (PRODUCT env var, IsChromium/IsFirefox/IsWebkit props)
- Replace xunit/xunit.runner.visualstudio packages with NUnit 4.1.0, NUnit3TestAdapter 4.6.0, NUnit.Analyzers 4.3.0
- Replace Playwright.Testing.Xunit project reference with Playwright.Nunit
- Rewrite base test classes: [SetUp]/[TearDown] instead of IAsyncLifetime, [SetUpFixture] for global setup
- Remove ITestOutputHelper constructors, [Collection] attributes, xUnit test framework customization
- Convert all test attributes: [Fact] -> [Test], [Fact(Skip=...)] -> [Test, Ignore(...)], [Theory]/[InlineData] -> [TestCase]
- Convert all assertions to NUnit constraint model (Assert.That with Is.EqualTo, Does.Contain, etc.)
- Convert Assert.ThrowsAsync/ThrowsAnyAsync to NUnit equivalents (ThrowsAsync/CatchAsync)
- Delete xUnit infrastructure: PlaywrightSharpBrowserLoaderCollection, PlaywrightXunitTest* classes, XunitLogger, xunit.runner.json
- Add [assembly: NonParallelizable] via PlaywrightSharpSetUpFixture
- Update SkipBrowserAndPlatformFact to use NUnit's IApplyToTest pattern

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kblok
Copy link
Member Author

kblok commented Mar 18, 2026

Will be combined with rename and CI/CD into a single PR

@kblok kblok closed this Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Infra: Migrate test framework from xUnit to NUnit (modeled after puppeteer-sharp)

1 participant