Table of Contents

Method InvokeTestMethod

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

InvokeTestMethod(TContext, object?)

Called by InvokeTest(TContext, object?) to invoke the test method.

protected virtual object? InvokeTestMethod(TContext ctxt, object? testClassInstance)

Parameters

ctxt TContext

The context that describes the current test

testClassInstance object

The instance of the test class (may be null when running a static test method)

Returns

object

Returns the result of the test method invocation. This value is evaluated to determine if it indicates asynchronous execution (by calling TryConvertToValueTask(object?)) so that InvokeTest(TContext, object?) can wait on the resulting operation.

Remarks

By default, this uses reflection to invoke the test method from the context. Developers can override this method to replace the test method invocation and/or to add operations before/after the test method is invoked.