Meziantou.Xunit.ParallelTestFramework
2.0.0
Prefix Reserved
See the version list below for details.
dotnet add package Meziantou.Xunit.ParallelTestFramework --version 2.0.0
NuGet\Install-Package Meziantou.Xunit.ParallelTestFramework -Version 2.0.0
<PackageReference Include="Meziantou.Xunit.ParallelTestFramework" Version="2.0.0" />
paket add Meziantou.Xunit.ParallelTestFramework --version 2.0.0
#r "nuget: Meziantou.Xunit.ParallelTestFramework, 2.0.0"
// Install Meziantou.Xunit.ParallelTestFramework as a Cake Addin #addin nuget:?package=Meziantou.Xunit.ParallelTestFramework&version=2.0.0 // Install Meziantou.Xunit.ParallelTestFramework as a Cake Tool #tool nuget:?package=Meziantou.Xunit.ParallelTestFramework&version=2.0.0
By default, xUnit runs all test cases in a test class synchronously. This package extends the default test framework to execute tests in parallel.
dotnet add package Meziantou.Xunit.ParallelTestFramework
By default, all tests will run in parallel.
Selectively disable parallelization by adding the DisableParallelization
attribute to a collection or theory.
// All tests are run in parallel
public class ParallelTests
{
[Fact]
public void Test1() => Thread.Sleep(2000);
[Fact]
public void Test2() => Thread.Sleep(2000);
[Theory]
[InlineData(0), InlineData(1), InlineData(2)]
public void Test3(int value) => Thread.Sleep(2000);
// This test runs in parallel with other tests
// However, its test cases are run sequentially
[Theory]
[DisableParallelization]
[InlineData(0), InlineData(1), InlineData(2)]
public void Test4(int value) => Thread.Sleep(2000);
}
// This collection runs in parallel with other collections
// However, its tests cases are run sequentially
[DisableParallelization]
public class SequentialTests
{
[Fact]
public void Test1() => Thread.Sleep(2000);
[Fact]
public void Test2() => Thread.Sleep(2000);
}
Previous versions of this package relied on built in xUnit attributes instead of exposing a dedicated DisableParallelization
attribute.
For backwards compatibility, parallelization can also be disabled by adding an explicit Collection
attribute or Theory
attribute with DisableDiscoveryEnumeration
enabled.
// All tests are run in parallel
public class ParallelTests
{
[Fact]
public void Test1() => Thread.Sleep(2000);
[Fact]
public void Test2() => Thread.Sleep(2000);
[Theory]
[InlineData(0), InlineData(1), InlineData(2)]
public void Test3(int value) => Thread.Sleep(2000);
// This test runs in parallel with other tests
// However, its test cases are run sequentially because of DisableDiscoveryEnumeration
[Theory]
[MemberData(nameof(GetData), DisableDiscoveryEnumeration = true)]
public void Test4(int value) => Thread.Sleep(2000);
public static TheoryData<int> GetData() => new() { { 0 }, { 1 } };
}
// This collection runs in parallel with other collections
// However, its tests cases are run sequentially because the Collection is explicit
[Collection("Sequential")]
public class SequentialTests
{
[Fact]
public void Test1() => Thread.Sleep(2000);
[Fact]
public void Test2() => Thread.Sleep(2000);
}
The code is greatly inspired by the sample from Travis Mortimer: https://github.com/xunit/xunit/issues/1986#issuecomment-831322722
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- xunit.extensibility.execution (>= 2.4.2)
-
net6.0
- xunit.extensibility.execution (>= 2.4.2)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Meziantou.Xunit.ParallelTestFramework:
Package | Downloads |
---|---|
FunFair.Test.Common
FunFair Common Test Infrastructure for building xUnit tests on top of. |
|
BunsenBurner.Xunit
Integration with [xUnit.net](https://github.com/xunit/xunit) to easily consume Bunsen Burner |
|
Saucery.XUnit
Sorcery for SauceLabs - Unlocking SauceLabs capability |
GitHub repositories (8)
Showing the top 5 popular GitHub repositories that depend on Meziantou.Xunit.ParallelTestFramework:
Repository | Stars |
---|---|
riok/mapperly
A .NET source generator for generating object mappings. No runtime reflection.
|
|
alirezanet/Husky.Net
Git hooks made easy with Husky.Net internal task runner! 🐶 It brings the dev-dependency concept to the .NET world!
|
|
meziantou/Meziantou.Framework
|
|
ForNeVeR/Cesium
C compiler for the CLI platform
|
|
platformplatform/PlatformPlatform
Alpha state. A platform designed for building enterprise-grade, multi-tenant products using Azure, .NET, React, TypeScript, Infrastructure as Code, etc.
|