XUnit.Extensions.MaxParallelization
1.0.8
See the version list below for details.
dotnet add package XUnit.Extensions.MaxParallelization --version 1.0.8
NuGet\Install-Package XUnit.Extensions.MaxParallelization -Version 1.0.8
<PackageReference Include="XUnit.Extensions.MaxParallelization" Version="1.0.8" />
paket add XUnit.Extensions.MaxParallelization --version 1.0.8
#r "nuget: XUnit.Extensions.MaxParallelization, 1.0.8"
// Install XUnit.Extensions.MaxParallelization as a Cake Addin #addin nuget:?package=XUnit.Extensions.MaxParallelization&version=1.0.8 // Install XUnit.Extensions.MaxParallelization as a Cake Tool #tool nuget:?package=XUnit.Extensions.MaxParallelization&version=1.0.8
XUnit.Extensions.MaxParallelization
Setup
Install the nuget package:
NuGet\Install-Package XUnit.Extensions.MaxParallelization
Then you need to add the following assembly attribute:
[assembly: TestFramework("XUnit.Extensions.MaxParallelization.ParallelTestFramework", "XUnit.Extensions.MaxParallelization")]
Parallelization
With this library every test cases, classes and collections will run in parallel. Therefore if you don't want a test case a class or a collection you will need to set the DisableParallelization
attribute over the class or the test method on which you do not want to run in parallel.
For collections you need to set it inside the CollectionDefinition
attribute likeso:
[CollectionDefinition("DisableParallelization",DisableParallelization = true)]
Dependency Injection
This extension change the way dependency injection is handled in XUnit. I wanted to make this more like it is handled in ASP.Net.
public class FixtureRegister : IFixtureRegister
{
public void RegisterFixtures(FixtureRegistrationCollection container)
{
container.AddFixture<OrderingFixture>()
.AddFixture<CollectionParallelTestFixture>(FixtureRegisterationLevel.Collection)
.AddFixture<AssemblyParallelTestFixture>(FixtureRegisterationLevel.Assembly)
.AddFixture<ClassParallelTestFixture>(FixtureRegisterationLevel.Class)
.AddFixture<MethodParallelTestFixture>(FixtureRegisterationLevel.Method);
}
}
The FixtureRegisterationLevel
is there to declare the scope of the dependency.
Assembly
will create a singleton for the whole assembly
Collection
create an instance that will be shared among all the tests cases in the same collections
Class
create an instance that will be shared among tests cases in the same class
Method
Create an instance for each test case.
You can pass an instance as a parameter but unless the scope is assembly the dependency will be reinstanciated at some point.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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. |
-
net6.0
- xunit.extensibility.execution (>= 2.4.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.