Skip to content
ConsoleMonster

API Reference

Class

TestRun

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 optionalposition: 0
The run clock (elapsed time since the run started); null uses a stopwatch started now.

Methods

public Void ContainerFinished(String key) #
Returns: Void

A container ended.

Parameters

key System.String requiredposition: 0
The container key.
public Void ContainerQueued(String key, String name, String? file, Int32 tests = 0) #
Returns: Void

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

Parameters

key System.String requiredposition: 0
A unique key (the file path).
name System.String requiredposition: 1
The display name (the file name).
file System.String? requiredposition: 2
The full path, or null.
tests System.Int32 = 0 optionalposition: 3
The tests it will run, or 0 when not known yet.
public Void ContainerStarted(String key, String name, String? file, Int32 tests) #
Returns: Void

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

Parameters

key System.String requiredposition: 0
A unique key (the file path).
name System.String requiredposition: 1
The display name (the file name).
file System.String? requiredposition: 2
The full path, or null.
tests System.Int32 requiredposition: 3
The tests it will run, or 0 when unknown.
public Void Discovered(Int32 total) #
Returns: Void

Discovery finished: the number of tests that will run.

Parameters

total System.Int32 requiredposition: 0
The planned test count.
public Void Finished() #
Returns: Void

The run ended; the clock stops.

public TestRunSnapshot Snapshot() #
Returns: TestRunSnapshot

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

Returns

The snapshot.

public Void TestFinished(TestRecord record) #
Returns: Void

A test ended (or, with TestRecord.IsBlockFailure, a block failed outside a test). Failures with a message are listed; a failed test without a message (it failed because its block did) is only counted.

Parameters

record ConsoleMonster.TestRuns.TestRecord requiredposition: 0
The record.
public Void TestStarted(String container, IReadOnlyList<String>? blocks, String name) #
Returns: Void

A test starts.

Parameters

container System.String requiredposition: 0
The container key.
blocks System.Collections.Generic.IReadOnlyList<System.String>? requiredposition: 1
The enclosing blocks, outermost first.
name System.String requiredposition: 2
The test name.

Properties

public Int32 SlowestCount { get; set; } #

How many slowest tests snapshots keep (default 5).

public TimeSpan Elapsed { get; } #

The run clock.