microsoft / playwright-dotnet

.NET version of the Playwright testing and automation library.
https://playwright.dev/dotnet/
MIT License
2.5k stars 237 forks source link

[Feature]: Add support for running parallel .Net tests with xUnit v >= 2.8 #2977

Open ebjornset opened 3 months ago

ebjornset commented 3 months ago

🚀 Feature Request

From the docks it seems that Playwright does not support running tests in parallel with xUnit, due to limitations in the xUnit framework, https://playwright.dev/dotnet/docs/test-runners#xunit-support

xUnit 2.8 has added support for only starting the specified number of test when running test in parallel, using the "conservative" algorithm, see https://xunit.net/docs/running-tests-in-parallel#algorithms for details.

I guess this xUnit feature has removed the limitation mentioned in the docs, and that it's now possible to support running Playwright tests in parallel with xUnit?

Example

I suppose the docs would need to be updated to describe that running tests in parallel requires the xUnit "conservative" parallelism algorithm, and maybe Playwright it self would need some configuration to enable/disable parallelism?

When parallelism is configured Playwright should just "do its magic under the hoods". When its turned off the tests should run in sequence.

Motivation

It would make using Playwright with xUnit a better tool set, since a Playwright xUnit test suite can give faster feedback.