Class StepResult
- Namespace
- TinyBDD
- Assembly
- TinyBDD.dll
Represents a single executed step in a scenario (Given/When/Then/And/But), including title, elapsed time, and any error captured.
public sealed class StepResult
- Inheritance
-
StepResult
- Inherited Members
Examples
var ctx = Bdd.CreateContext(this);
await Bdd.Given(ctx, "seed", () => 1)
.When("+1", x => x + 1)
.Then("== 2", v => v == 2);
// Inspect executed steps for custom reporting
foreach (var step in ctx.Steps)
{
Console.WriteLine($"{step.Kind} {step.Title} [{step.Elapsed.TotalMilliseconds} ms] " +
(step.Error is null ? "OK" : $"FAILED: {step.Error.Message}"));
}
Remarks
Instances of this type are created by TinyBDD when executing steps and are exposed via Steps for reporting and diagnostics. The properties are immutable and reflect the outcome of a single step execution.
The Elapsed value captures the duration of the user-provided delegate for the step as measured by TinyBDD. The Error is populated when a step throws; frameworks may display this information alongside the step in test output.
Properties
Elapsed
Elapsed time for executing the step.
public TimeSpan Elapsed { get; init; }
Property Value
Error
Exception captured during step execution, if any.
public Exception? Error { get; init; }
Property Value
Kind
Step kind keyword as rendered in reports (e.g., Given, When, Then, And, But).
public required string Kind { get; init; }
Property Value
Title
Human-readable step title.
public required string Title { get; init; }