Class ScenarioContextGherkinExtensions
- Namespace
- TinyBDD
- Assembly
- TinyBDD.dll
Extension methods for writing a ScenarioContext in Gherkin format via an IBddReporter.
public static class ScenarioContextGherkinExtensions
- Inheritance
-
ScenarioContextGherkinExtensions
- Inherited Members
Examples
var ctx = Bdd.CreateContext(this);
await Bdd.Given(ctx, "start", () => 2)
.When("double", x => x * 2)
.Then(">= 4", v => v >= 4);
ctx.WriteGherkinTo(new StringBddReporter());
Remarks
These helpers delegate to GherkinFormatter to format the context into human-friendly text. Use them after a scenario has executed to emit a compact report.
Methods
WriteGherkinTo(ScenarioContext, IBddReporter)
Writes the formatted Gherkin representation of a scenario to an output reporter. This method delegates to Write(ScenarioContext, IBddReporter) to format and output details about the feature, optional description, scenario, steps, elapsed time, status, and any errors encountered during step execution.
public static void WriteGherkinTo(this ScenarioContext ctx, IBddReporter reporter)
Parameters
ctxScenarioContextThe current ScenarioContext containing feature and scenario information.
reporterIBddReporterAn IBddReporter that receives formatted lines of text.