TestRecord
ConsoleMonster.TestRuns
One finished test of a TestRun: where it lives (container, blocks), how it ended, how long it took, and for a failure the message and the location. Test frameworks are mapped onto it by adapters (for example Invoke-ConsolePester for Pester). Assessment engines add a TestRecord.Group (the product or area a check belongs to), a TestRecord.Severity and, for checks that did not run, a TestRecord.Reason.
Inheritance
- object
- TestRecord
Usage
Explore 52 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.
Returned or exposed by 25
- Extension method TestRecord.BlockFailure
- Extension method TestRecord.Blocks
- Extension method TestRecord.Duration
- Extension method TestRecord.ErrorType
- Extension method TestRecord.File
- Extension method TestRecord.Group
- Extension method TestRecord.Line
- Extension method TestRecord.Message
- Extension method TestRecord.Reason
- Extension method TestRecord.ReasonCode
- Extension method TestRecord.Severity
- Method TestRecordFluent.BlockFailure
- Method TestRecordFluent.Blocks
- Method TestRecordFluent.Duration
- Method TestRecordFluent.ErrorType
- Method TestRecordFluent.File
- Method TestRecordFluent.Group
- Method TestRecordFluent.Line
- Method TestRecordFluent.Message
- Method TestRecordFluent.Reason
- Method TestRecordFluent.ReasonCode
- Method TestRecordFluent.Severity
- Property TestRunSnapshot.Failures
- Property TestRunSnapshot.Investigations
- Property TestRunSnapshot.Slowest
Accepted by parameters 27
- Extension method TestRecord.BlockFailure
- Extension method TestRecord.Blocks
- Extension method TestRecord.Duration
- Extension method TestRecord.ErrorType
- Extension method TestRecord.File
- Extension method TestRecord.Group
- Extension method TestRecord.Line
- Extension method TestRecord.Message
- Extension method TestRecord.Reason
- Extension method TestRecord.ReasonCode
- Extension method TestRecord.Severity
- Method TestRecordFluent.BlockFailure
- Method TestRecordFluent.Blocks
- Method TestRecordFluent.Duration
- Method TestRecordFluent.ErrorType
- Method TestRecordFluent.File
- Method TestRecordFluent.Group
- Method TestRecordFluent.Line
- Method TestRecordFluent.Message
- Method TestRecordFluent.Reason
- Method TestRecordFluent.ReasonCode
- Method TestRecordFluent.Severity
- Method TestRun.TestFinished
- Method TestRunText.FailureLine
- Method TestRunText.FailureLines
- Method TestRunText.Link
- Method TestRunText.Location
Constructors
public TestRecord(string container, string name, StatusKind status) #Creates a record.
Parameters
- container string
- The container key (a test file, usually its full path).
- name string
- The test name (expanded, as reported).
- status ConsoleMonster.Styling.StatusKind
- How it ended: Pass, Fail, Error (could not run to a verdict), Investigate, Skip, NotRun, Warn (inconclusive) or Pending (not reported).
Methods
public static StatusKind ParseStatus(string? result) #The status for a test framework's result word: Passed, Failed, Skipped, Inconclusive and NotRun (Pester, xUnit, NUnit and MSTest use these words), Error (or Errored, Timeout), Investigate and NotExecuted. Inconclusive is a warning; anything else is Pending.
Parameters
- result string?
- The result word.
Inherited Methods
Properties
public IReadOnlyList<string> Blocks { get; set; } #The enclosing blocks, outermost first (Describe, Context).
public string? File { get; set; } #The file of the failing line (or of the test), or null.
public int Line { get; set; } #The failing line (or the test's first line), or 0 when unknown.
public string? ErrorType { get; set; } #The exception type of an error that is not an assertion (shown before the message), or null.
public Severity? Severity { get; set; } #How serious the finding is when the check fails, or null. A summary shows the worst severity among the records that did not pass.
public string? Group { get; set; } #The group a summary counts the record under (a product, an area, a category), or null to count it under its container.
public string? ReasonCode { get; set; } #A stable code for why a check was skipped or not run (NotApplicable, ServiceNotConnected, DryRun), or null. Summaries count skipped and not-run records by this code.
public string? Reason { get; set; } #A sentence for why a check was skipped or not run, or null. Summaries use it when there is no code.
public bool IsBlockFailure { get; set; } #Whether the record stands for a block or container that failed outside a test (setup, teardown, discovery).
Extension Methods
public static TestRecord BlockFailure(TestRecord testRecord, bool value = true) #Sets TestRecord.IsBlockFailure: Whether the record stands for a block or container that failed outside a test (setup, teardown, discovery).
Parameters
- testRecord ConsoleMonster.TestRuns.TestRecord
- The instance.
- value bool = true
- The value; true when omitted.
Examples
// C# initializer or property // C# fluent
testRecord.IsBlockFailure = value; testRecord.BlockFailure(value);public static TestRecord Blocks(TestRecord testRecord, IReadOnlyList<string> value) #Sets TestRecord.Blocks: The enclosing blocks, outermost first (Describe, Context).
Parameters
- testRecord ConsoleMonster.TestRuns.TestRecord
- The instance.
- value System.Collections.Generic.IReadOnlyList<string>
- The value.
Examples
// C# initializer or property // C# fluent
testRecord.Blocks = value; testRecord.Blocks(value);public static TestRecord Duration(TestRecord testRecord, TimeSpan value) #Sets TestRecord.Duration: How long the test took.
Parameters
- testRecord ConsoleMonster.TestRuns.TestRecord
- The instance.
- value System.TimeSpan
- The value.
Examples
// C# initializer or property // C# fluent
testRecord.Duration = value; testRecord.Duration(value);public static TestRecord ErrorType(TestRecord testRecord, string? value) #Sets TestRecord.ErrorType: The exception type of an error that is not an assertion (shown before the message), or null.
Parameters
- testRecord ConsoleMonster.TestRuns.TestRecord
- The instance.
- value string?
- The value.
Examples
// C# initializer or property // C# fluent
testRecord.ErrorType = value; testRecord.ErrorType(value);public static TestRecord File(TestRecord testRecord, string? value) #Sets TestRecord.File: The file of the failing line (or of the test), or null.
Parameters
- testRecord ConsoleMonster.TestRuns.TestRecord
- The instance.
- value string?
- The value.
Examples
// C# initializer or property // C# fluent
testRecord.File = value; testRecord.File(value);public static TestRecord Group(TestRecord testRecord, string? value) #Sets TestRecord.Group: The group a summary counts the record under (a product, an area, a category), or null to count it under its container.
Parameters
- testRecord ConsoleMonster.TestRuns.TestRecord
- The instance.
- value string?
- The value.
Examples
// C# initializer or property // C# fluent
testRecord.Group = value; testRecord.Group(value);public static TestRecord Line(TestRecord testRecord, int value) #Sets TestRecord.Line: The failing line (or the test's first line), or 0 when unknown.
Parameters
- testRecord ConsoleMonster.TestRuns.TestRecord
- The instance.
- value int
- The value.
Examples
// C# initializer or property // C# fluent
testRecord.Line = value; testRecord.Line(value);public static TestRecord Message(TestRecord testRecord, string? value) #Sets TestRecord.Message: The failure message, or null.
Parameters
- testRecord ConsoleMonster.TestRuns.TestRecord
- The instance.
- value string?
- The value.
Examples
// C# initializer or property // C# fluent
testRecord.Message = value; testRecord.Message(value);public static TestRecord Reason(TestRecord testRecord, string? value) #Sets TestRecord.Reason: A sentence for why a check was skipped or not run, or null. Summaries use it when there is no code.
Parameters
- testRecord ConsoleMonster.TestRuns.TestRecord
- The instance.
- value string?
- The value.
Examples
// C# initializer or property // C# fluent
testRecord.Reason = value; testRecord.Reason(value);public static TestRecord ReasonCode(TestRecord testRecord, string? value) #Sets TestRecord.ReasonCode: A stable code for why a check was skipped or not run (NotApplicable, ServiceNotConnected, DryRun), or null. Summaries count skipped and not-run records by this code.
Parameters
- testRecord ConsoleMonster.TestRuns.TestRecord
- The instance.
- value string?
- The value.
Examples
// C# initializer or property // C# fluent
testRecord.ReasonCode = value; testRecord.ReasonCode(value);public static TestRecord Severity(TestRecord testRecord, Severity? value) #Sets TestRecord.Severity: How serious the finding is when the check fails, or null. A summary shows the worst severity among the records that did not pass.
Parameters
- testRecord ConsoleMonster.TestRuns.TestRecord
- The instance.
- value ConsoleMonster.Styling.Severity?
- The value.
Examples
// C# initializer or property // C# fluent
testRecord.Severity = value; testRecord.Severity(value);