Skip to content

LooksBeforeTeardownExecutor

Namespace: E2E.TUnit

public sealed class LooksBeforeTeardownExecutor : ITestExecutor

Wraps the test method, so the app is looked at the moment the body fails, as upstream does. A derived [After(Test)] hook runs after the method, and runs before this fixture’s own, so it could navigate away first. The wrapper also keeps what the body did, because TUnit sets the test result only after its hooks have run.

Inheritance: object

Implements: ITestExecutor

View source

public ValueTask ExecuteTest(TestContext context, Func<ValueTask> action)

Executes a test within the provided test context.

Parameters

Name Type Description
context TestContext The test context containing information about the test being executed, including test details, dependency information, and result tracking.
action Func<ValueTask> A function that represents the test body to be executed, which returns a ValueTask.

Returns: ValueTask — A ValueTask that represents the asynchronous execution of the test. When the returned task completes, the test execution has finished.

<p> Called by the test framework to execute a test. The implementation defines how the test is executed, such as on which thread or with what synchronization context. </p> <p> Custom test executors can provide specialized execution environments, such as running tests on the STA thread or with specific threading models. This is particularly useful for testing UI components or code that has specific threading requirements. </p> <p> The method should ensure that any exceptions thrown during test execution are properly propagated back to the caller to ensure correct test result reporting. </p>