E2ERunFixture
Namespace: E2E.TUnit
public abstract class E2ERunFixtureA .NET-only run-level hook (upstream’s runner stops the app commands and calls the reporters when the run ends; TUnit has no such owner). Derive a
public, non-abstract class with a public parameterless constructor from it in the test project, and the app commands that the targets declare stop
when the last test of the run is done, not when the test process exits, and the reporters run (see E2E.Reports.Reporter):
public sealed class AppCommands : E2ERunFixture;A project that declares no such class runs none of this: TUnit runs a hook of a library for every project that references it, so the hook looks for the classes derived from this one in the test assembly, and does nothing when there are none. A run with several of them runs each.
Inheritance: object
Properties
Section titled “Properties”ChangedSince
Section titled “ChangedSince”protected virtual string? ChangedSince { get; }The base ref to measure the change from (upstream’s --changed-since). Unset, the E2E_CHANGED_SINCE environment variable; with neither, no filter runs.
Value: string
Config
Section titled “Config”protected virtual E2EConfig Config { get; }The config the filters read: the discovered e2e.config.json, or the defaults when there is none.
Value: E2EConfig
Filters
Section titled “Filters”protected virtual IReadOnlyList<ITestFilter> Filters { get; }The test filters, in order. They run only when ChangedSince or E2E_CHANGED_SINCE names a base ref; each judges
the tests and the files changed since that ref, and a test it leaves out is skipped with its reason. Empty by default.
Value: IReadOnlyList<ITestFilter>
LastFailed
Section titled “LastFailed”protected virtual bool LastFailed { get; }Whether to run only the tests the previous run did not pass (upstream’s --last-failed). Unset, the E2E_LAST_FAILED environment variable
(1 or true). The previous run’s report.json is read from the output directory before this run replaces it; none there is
NO_LAST_RUN. The tests it passed skip themselves with the reason did not fail in the last run, the filters do not run, and
LastRun hands the previous report to the reporters.
Value: bool
Methods
Section titled “Methods”SelectTestsAsync(CancellationToken)
Section titled “SelectTestsAsync(CancellationToken)”[Before(HookType.TestSession)]public static Task SelectTestsAsync(CancellationToken cancellationToken)Creates the run fixtures the test assembly declares and starts each, before the first test.
Parameters
| Name | Type | Description |
|---|---|---|
cancellationToken |
CancellationToken |
Returns: Task
StopAppCommandsAsync()
Section titled “StopAppCommandsAsync()”[After(HookType.TestSession)]public static Task StopAppCommandsAsync()Finishes each run fixture of the run, after the last test.
Returns: Task