Core Framework v3 3.2.0-pre.5 2025 September 5
Today, we're shipping one new prerelease:
- xUnit.net Core Framework v3
3.2.0-pre.5
As always, we'd like to thank all the users who contributed to the success of xUnit.net through usage, feedback, and code. 🎉
Microsoft Testing Platform v2
This prerelease build is released for users to be able to use preview builds of Microsoft Testing Platform v2. It is anticipated that Microsoft Testing Platform v2 RTM will ship sometime around the same time as .NET 10 SDK RTM. Our plan is for xUnit.net v3 3.2.0 RTM to also ship around the same time.
Updated Templates with net10.0
Support
The version of the xunit.v3.templates
NuGet package included in this build now supports targeting .NET 10 (net10.0
). You can set the framework for dotnet new
templates by passing --framework <tfm>
to the dotnet new
command line.
- The default framework for
xunit3
will remainnet8.0
until it reaches end of life - The default framework for
xunit3-extension
will remainnetstandard2.0
indefinitely
Support for dotnet.config
with .NET 10 SDK
When unfolding the xunit3
template targeting net10.0
, it will create a dotnet.config
file in the solution folder root. The dotnet.config
file replaces (and obsoletes) the MSBuild property TestingPlatformDotnetTestSupport
when using .NET 10 SDK, to let dotnet test
know whether you plan to use VSTest mode or MTP mode.
For more information about dotnet.config
, please see the dotnet test documentation.
Note
The template action that this depends on has not yet shipped as of today (in .NET 10 SDK Preview 7). We anticipate that this will ship sometime before the .NET 10 SDK RTM. This new file is a requirement for Microsoft Testing Platform v2 to use the new MTP-enabled dotnet test
when running with .NET 10 SDK, as VSTest mode will no longer be supported for MTP v2 projects when using .NET 10 SDK.
In the meantime, users who are using preview versions of .NET 10 SDK will need to hand-create a dotnet.config
file in their solution folder root, with the following contents:
[dotnet.test.runner]
name = "Microsoft.Testing.Platform"
Note that the requirement to use dotnet.config
with .NET 10 SDK with MTP v2 is true regardless of the target framework that your tests target. If you try to run dotnet test
against an MTP v2 enabled test project from .NET 10 SDK without creating the required dotnet.config
file first, the system will report an error, which includes a link to Microsoft documentation.
Release Notes
An RTM release for 3.1.0 is currently planned within the next couple weeks, and this preview release includes features from that codebase as well. Those new features are listed below.
Core Framework
We have added a new
XunitSerializer<T>
class which can be used as a base class when implementingIXunitSerializer
for one type. This adds type safety to the APIs (giving instances ofT
toSerialize
andIsSerializable
, and expecting an instance ofT
fromDeserialize
), as well as providing some boilerplate logic to ensure this type safety at runtime. This also includes automatic support for arrays of values, meaning thatIsSerializable
will be called repeatedly with the instances of values in the array rather than being called just once with the array itself (as is the case withIXunitSerializer.IsSerializable
).We have enhanced the support for event source events produced by xUnit.net. In addition to
TestStart
andTestStop
events, we have also addedTestAssemblyStart
,TestAssemblyStop
,TestCollectionStart
,TestCollectionStop
,TestClassStart
,TestClassStop
,TestMethodStart
,TestMethodStop
,TestCaseStart
, andTestCaseStop
. We have also added a newresult
value toTestStop
to indicate what the final test result was. xunit/xunit#3386Note
Known issue: the result in
TestStop
will incorrectly reportPassed
for tests which timed out. This will be fixed by the time 3.1.0 ships as RTM.BUG: We have fixed an issue where
IRunnerReporterMessageHandler.DisposeAsync
was not being called. xunit/xunit#3385BUG: We have fixed a bug in
ConsoleRunnerInProcess
(which is primarily used by NCrunch) where we were causing an extra unnecessary discovery phase when trying to run individual tests. This should improve individual test execution performance.
Assertion Library
- BUG: We have fixed an issue with
Assert.EquivalentWithExclusions
with the way that collections are handled. The expression for collections must now include[]
at the end of a collection property/field name. For example, the expressionMyCollection[].MyProperty
will excludeMyProperty
when comparing values inside theMyCollection
collection. For more information, see the attached issue. xunit/xunit#3394
Runners
We have updated the Azure DevOps runner reporter to use the latest versions of the APIs. xunit/xunit#3376
We have updated the default runner reporter to report the test assembly's unique ID in the "Finished" message displayed on-screen, rather than in the summary, due to the fact that some runners (like
dotnet test
) did not display the summary. xunit/xunit#3365We have updated the
-list full
output from the in-process console runner to include the test case unique ID of each discovered test (this is available in both human-readable form as well as JSON form via-list full/json
). We have also added a-id
switch that allows the user to run a test case by unique ID. This complements the existing MTP command line switch (--filter-uid
) which also allows running a test case by unique ID. xunit/xunit#3179BUG: We have fixed the output of the JUnit report to conform to the JUnit 4 XSD. This changed the skip counter attribute name in
testsuites
fromskipped
todisabled
, and removes the attachment, traits, and warning nodes that were previously (illegally) reported under thetestsuite
. xunit/xunit#3393
Runner Utility
- We have added
XunitProjectAssembly.TestCaseIDsToRun
, which allows runner authors to specify test cases they wish to run by ID. This supplements the existingXunitProjectAssembly.TestCasesToRun
, which allows runner authors to specify test cases they wish to run by providing the serialized test case. This is used by the new-id
console runner switch mentioned above. xunit/xunit#3179
Microsoft Testing Platform
- We will only pre-enumerate theory data rows by default when running in Test Explorer now. Previously we would pre-enumerate theory data rows by default when running in
dotnet test
, but we are skipping this now by default (as a performance optimization). You can as always force pre-enumeration through configuration.