Skip to content

Conversation

@mxschmitt
Copy link
Contributor

@mxschmitt mxschmitt commented Jan 23, 2025

This PR adds support for xUnit.v3. The difference is that by default it uses MTP (Microsoft Testing Protocol) which means test discovery and execution are in two different processes. In order to workaround this we are serialising the settings as an environment variable which reaches the execution process later on. This seems like an acceptable workaround for now as per @nohwnd.

Context:

Fixes #3093

@jonathh21
Copy link

Can I plus one this with ever fibre of my being.

Having just looked over the wrap sheet for v3... I'd really like to be able to take screenshots and have them attached to the test results.

@nohwnd
Copy link
Member

nohwnd commented Apr 15, 2025

Hacky, but I cannot think about a better way to do this.

@mxschmitt mxschmitt marked this pull request as ready for review August 5, 2025 11:28
@mxschmitt mxschmitt requested a review from Copilot August 5, 2025 11:40
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces support for xUnit.v3, which uses the Microsoft Testing Protocol (MTP) with separate processes for test discovery and execution. To enable settings sharing between processes, the implementation serializes settings as an environment variable that reaches the execution process.

  • Adds xUnit.v3 support with MTP compatibility
  • Implements environment variable-based settings serialization for cross-process communication
  • Creates new xUnit.v3 test classes mirroring the existing xUnit v2 structure

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
AssertionsBase.cs Adds InternalsVisibleTo attribute for the new xUnit.v3 assembly
Playwright.sln Includes the new Playwright.Xunit.v3 project in the solution
Playwright.Xunit.v3/*.cs New xUnit.v3 test base classes (WorkerAwareTest, PlaywrightTest, PageTest, etc.)
Playwright.Xunit.v3.csproj Project configuration for the xUnit.v3 package
PlaywrightSettingsProvider.cs Adds environment variable-based settings serialization for MTP support
PlaywrightSettingsXml.cs Changes properties from private setters to public setters for serialization
TestingHarnessTest files Test infrastructure updates and comprehensive test coverage for xUnit.v3
Comments suppressed due to low confidence (1)

src/Playwright.TestingHarnessTest/Playwright.TestingHarnessTest.csproj:32

  • The xunit.v3 package version "2.0.0" may not exist. Based on available information, xUnit v3 is still in development and stable releases typically follow semantic versioning. Consider verifying this version exists or using a pre-release version like "2.0.0-pre.1" if available.
    <PackageReference Include="xunit.v3" Version="2.0.0" Condition="'$(TEST_MODE)' == 'xunit.v3'" />

@mxschmitt mxschmitt merged commit a7547c9 into main Aug 5, 2025
16 checks passed
@mxschmitt mxschmitt deleted the feature/xunit.v3 branch August 5, 2025 13:33
@julealgon
Copy link

@mxschmitt I noticed the NuGet package for this hasn't been pushed yet.

Do you have an ETA of when that is taking place?

@connorb08
Copy link

@mxschmitt I noticed the NuGet package for this hasn't been pushed yet.

Do you have an ETA of when that is taking place?

You should be able to use the pre-release Microsoft.Playwright.Xunit.v3 package version 1.55.0-beta-4

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.

[Feature]: Playwright.Xunit should have a V3 variant

7 participants