Table of Contents

Method OnTestFailed

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

OnTestFailed(TContext, Exception, decimal, string, string[]?)

This method is called when a test has failed. By default, this sends TestFailed.

protected virtual ValueTask<(bool Continue, TestResultState ResultState)> OnTestFailed(TContext ctxt, Exception exception, decimal executionTime, string output, string[]? warnings)

Parameters

ctxt TContext

The context that describes the current test

exception Exception

The exception that caused the test failure

executionTime decimal

The time spent running the test

output string

The output from the test

warnings string[]

The warnings that were generated during the test

Returns

ValueTask<(bool Continue, TestResultState ResultState)>

Return true if test execution should continue; false if it should be shut down.

Remarks

This method runs during CleaningUp and any exceptions thrown will contribute to test cleanup failure.