Table of Contents

Class XunitTestAssemblyRunnerBaseContext<TTestAssembly, TTestCase>

Namespace
Xunit.v3
Assembly
xunit.v3.core.dll
public class XunitTestAssemblyRunnerBaseContext<TTestAssembly, TTestCase> : TestAssemblyRunnerContext<TTestAssembly, TTestCase>, IAsyncLifetime, IAsyncDisposable where TTestAssembly : class, IXunitTestAssembly where TTestCase : class, IXunitTestCase

Type Parameters

TTestAssembly
TTestCase
Inheritance
TestAssemblyRunnerContext<TTestAssembly, TTestCase>
XunitTestAssemblyRunnerBaseContext<TTestAssembly, TTestCase>
Implements
Derived
Inherited Members

Constructors

XunitTestAssemblyRunnerBaseContext(TTestAssembly, IReadOnlyCollection<TTestCase>, IMessageSink, ITestFrameworkExecutionOptions, CancellationToken)

public XunitTestAssemblyRunnerBaseContext(TTestAssembly testAssembly, IReadOnlyCollection<TTestCase> testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions, CancellationToken cancellationToken)

Parameters

testAssembly TTestAssembly

The test assembly

testCases IReadOnlyCollection<TTestCase>

The test cases from the assembly

executionMessageSink IMessageSink

The message sink to send execution messages to

executionOptions ITestFrameworkExecutionOptions

The options used during test execution

cancellationToken CancellationToken

The cancellation token used to cancel execution

Properties

AssemblyFixtureMappings

Gets the mapping manager for assembly-level fixtures.

public FixtureMappingManager AssemblyFixtureMappings { get; }

Property Value

FixtureMappingManager

AssemblyTestCaseOrderer

Gets the assembly-level test case orderer, if one is present.

public ITestCaseOrderer? AssemblyTestCaseOrderer { get; }

Property Value

ITestCaseOrderer

AssemblyTestCollectionOrderer

Gets the assembly-level test collection orderer, if one is present.

public ITestCollectionOrderer? AssemblyTestCollectionOrderer { get; }

Property Value

ITestCollectionOrderer

DisableParallelization

Gets a flag which indicates whether the user has requested that parallelization be disabled.

public bool DisableParallelization { get; }

Property Value

bool

ExplicitOption

Gets a flag which indicates how explicit tests should be handled.

public ExplicitOption ExplicitOption { get; }

Property Value

ExplicitOption

MaxParallelThreads

Gets the maximum number of threads to use when running tests in parallel. If this returns a positive integer, that is the maximum number of threads; if it returns -1, that indicates that unlimited threads should be allowed.

public int MaxParallelThreads { get; }

Property Value

int

ParallelAlgorithm

Gets the algorithm used for parallelism.

public ParallelAlgorithm ParallelAlgorithm { get; }

Property Value

ParallelAlgorithm

TargetFramework

Gets the target framework that the test assembly is targeting. By default, this returns null. Test frameworks that are based on .NET runtime assemblies can look for TargetFrameworkAttribute decorated at the assembly level, which is added automatically by the compiler.

public override string TargetFramework { get; }

Property Value

string

TestAssembly

Gets the assembly that is being executed.

public TTestAssembly TestAssembly { get; }

Property Value

TTestAssembly

TestEnvironment

Gets the environment that the test are running in. By default, returns a string which indicates process bitness, processor architecture (when known), and the description of the runtime environment (from FrameworkDescription).

public override string TestEnvironment { get; }

Property Value

string

Remarks

Example: "64-bit (x64) .NET 8.0.11"

Methods

DisposeAsync()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

public override ValueTask DisposeAsync()

Returns

ValueTask

InitializeAsync()

Called immediately after the class has been created, before it is used.

public override ValueTask InitializeAsync()

Returns

ValueTask

RunTestCollection(IXunitTestCollection, IReadOnlyCollection<TTestCase>, ITestCaseOrderer)

Delegation of RunTestCollection(TContext, TTestCollection, IReadOnlyCollection<TTestCase>) that properly obeys the parallel algorithm requirements.

public ValueTask<RunSummary> RunTestCollection(IXunitTestCollection testCollection, IReadOnlyCollection<TTestCase> testCases, ITestCaseOrderer testCaseOrderer)

Parameters

testCollection IXunitTestCollection
testCases IReadOnlyCollection<TTestCase>
testCaseOrderer ITestCaseOrderer

Returns

ValueTask<RunSummary>

SetupParallelism()

Sets up the mechanics for parallelism.

public virtual void SetupParallelism()