Skip to content
ConsoleMonster
Class

TestRun

ConsoleMonster.TestRuns

Namespace
ConsoleMonster.TestRuns
Assembly
ConsoleMonster
Modifiers
sealed

The state of a test run, fed with events from a test framework adapter (discovery, container start, test start, test end, container end, run end) on any thread, and read by TestRunView and TestRunSummary through consistent snapshots. It knows nothing about a specific framework.

Inheritance

  • object
  • TestRun

Usage

Explore 1 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 1

Constructors

public TestRun(Func<TimeSpan>? clock = null) #

Creates a run.

Parameters

clock System.Func<System.TimeSpan>? = null optional
The run clock (elapsed time since the run started); null uses a stopwatch started now.

Methods

public void ContainerFinished(string key) #

A container ended.

Parameters

key string required
The container key.
public void ContainerQueued(string key, string name, string? file, int tests = 0) #

A container is known before it runs (a test file found up front, or discovered): it shows as queued.

Parameters

key string required
A unique key (the file path).
name string required
The display name (the file name).
file string? required
The full path, or null.
tests int = 0 optional
The tests it will run, or 0 when not known yet.
public void ContainerStarted(string key, string name, string? file, int tests) #

A container (a test file or script block) starts.

Parameters

key string required
A unique key (the file path).
name string required
The display name (the file name).
file string? required
The full path, or null.
tests int required
The tests it will run, or 0 when unknown.
public void Discovered(int total) #

Discovery finished: the number of tests that will run.

Parameters

total int required
The planned test count.
public void Finished() #

The run ended; the clock stops.

public TestRunSnapshot Snapshot() #

A consistent copy of the state, for rendering on another thread.

Returns

TestRunSnapshot The snapshot.
public void TestFinished(TestRecord record) #

A test ended (or, with TestRecord.IsBlockFailure, a block failed outside a test). Failures and errors with a message are listed; a failed test without a message (it failed because its block did) is only counted. A record with a TestRecord.Group is also counted under that group, and skipped or not-run records are counted by their reason.

Parameters

record ConsoleMonster.TestRuns.TestRecord required
The record.
public void TestStarted(string container, IReadOnlyList<string>? blocks, string name) #

A test starts.

Parameters

container string required
The container key.
blocks System.Collections.Generic.IReadOnlyList<string>? required
The enclosing blocks, outermost first.
name string required
The test name.

Properties

public int SlowestCount { get; set; } #

How many slowest tests snapshots keep (default 5).

public TimeSpan Elapsed { get; } #

The run clock.