Table of Contents

Method OnTestFinished

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

OnTestFinished(TContext, decimal, string, string[]?, IReadOnlyDictionary<string, TestAttachment>?)

This method is called just after the test has finished running. By default, this sends TestFinished. Override this to enable any extensibility related to test finish.

protected virtual ValueTask<bool> OnTestFinished(TContext ctxt, decimal executionTime, string output, string[]? warnings, IReadOnlyDictionary<string, TestAttachment>? attachments)

Parameters

ctxt TContext

The context that describes the current test

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

attachments IReadOnlyDictionary<string, TestAttachment>

The attachments that were assocated with the test

Returns

ValueTask<bool>

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

Remarks

This method runs during Running and any exceptions thrown will be reported as top-level exceptions. Any exceptions that are present in the aggregator (presumably from derived implementations of this method, GetAttachments(TContext), GetTestOutput(TContext), GetWarnings(TContext), or RunTest(TContext)) will invoke OnTestCleanupFailure(TContext, Exception).