Table of Contents

Method FailTestCases

Namespace
Xunit.v3
Assembly
xunit.v3.core.dll

FailTestCases(IMessageBus, CancellationTokenSource, IReadOnlyCollection<ITestCase>, string, bool, bool, bool, bool, bool)

Fail a set of test cases with the given message.

public static RunSummary FailTestCases(IMessageBus messageBus, CancellationTokenSource cancellationTokenSource, IReadOnlyCollection<ITestCase> testCases, string messageFormat, bool sendTestCollectionMessages = false, bool sendTestClassMessages = false, bool sendTestMethodMessages = false, bool sendTestCaseMessages = true, bool sendTestMessages = true)

Parameters

messageBus

The message bus to send the messages to

cancellationTokenSource CancellationTokenSource

The cancellation token source to cancel if requested

testCases IReadOnlyCollection<ITestCase>

The test cases to fail

messageFormat string

A message template where {0} will be replaced with the display name of the test case during failure processing

sendTestCollectionMessages bool

Set to true to send ITestCollectionStarting and ITestCollectionFinished messages; set to false to skip

sendTestClassMessages bool

Set to true to send ITestClassStarting and ITestClassFinished messages; set to false to skip

sendTestMethodMessages bool

Set to true to send ITestMethodStarting and ITestMethodFinished messages; set to false to skip

sendTestCaseMessages bool

Set to true to send ITestCaseStarting and ITestCaseFinished messages; set to false to skip

sendTestMessages bool

Set to true to send ITestStarting and ITestFinished messages; set to false to skip

Returns

FailTestCases(IMessageBus, CancellationTokenSource, IReadOnlyCollection<ITestCase>, Exception, bool, bool, bool, bool, bool)

Fail a set of test cases with the given exception.

public static RunSummary FailTestCases(IMessageBus messageBus, CancellationTokenSource cancellationTokenSource, IReadOnlyCollection<ITestCase> testCases, Exception exception, bool sendTestCollectionMessages = false, bool sendTestClassMessages = false, bool sendTestMethodMessages = false, bool sendTestCaseMessages = true, bool sendTestMessages = true)

Parameters

messageBus

The message bus to send the messages to

cancellationTokenSource CancellationTokenSource

The cancellation token source to cancel if requested

testCases IReadOnlyCollection<ITestCase>

The test cases to fail

exception Exception

The exception to fail the test cases with

sendTestCollectionMessages bool

Set to true to send ITestCollectionStarting and ITestCollectionFinished messages; set to false to skip

sendTestClassMessages bool

Set to true to send ITestClassStarting and ITestClassFinished messages; set to false to skip

sendTestMethodMessages bool

Set to true to send ITestMethodStarting and ITestMethodFinished messages; set to false to skip

sendTestCaseMessages bool

Set to true to send ITestCaseStarting and ITestCaseFinished messages; set to false to skip

sendTestMessages bool

Set to true to send ITestStarting and ITestFinished messages; set to false to skip

Returns