Class TinyBddXunitBase
Base class for xUnit that initializes TinyBDD ambient context in the constructor and writes a Gherkin report when disposed at the end of the test.
[Feature("Unnamed Feature", null)]
public abstract class TinyBddXunitBase : TestBase, IAsyncLifetime
- Inheritance
-
TinyBddXunitBase
- Implements
-
IAsyncLifetime
- Inherited Members
Remarks
The constructor sets Current and wires an XunitTraitBridge. Xunit.IAsyncLifetime.InitializeAsync() executes any configured background steps. Xunit.IAsyncLifetime.DisposeAsync() emits a Gherkin report and clears the ambient context.
To configure background steps, override ConfigureBackground().
To configure feature-level setup/teardown, override ConfigureFeatureSetup() and ConfigureFeatureTeardown(). Feature setup runs once before the first test in the class, and feature teardown can be triggered manually via ExecuteFeatureTeardownExplicitlyAsync().
Constructors
TinyBddXunitBase(ITestOutputHelper)
Initializes the base with xUnit's Xunit.Abstractions.ITestOutputHelper and sets up TinyBDD context.
protected TinyBddXunitBase(ITestOutputHelper output)
Parameters
outputITestOutputHelper
Properties
Reporter
The reporter used to emit scenario output (e.g., Gherkin-style summaries) at cleanup. Framework-specific base classes should provide an appropriate implementation.
protected override IBddReporter Reporter { get; }
Property Value
Methods
DisposeAsync()
Writes a Gherkin report and clears the ambient context.
public virtual Task DisposeAsync()
Returns
ExecuteFeatureTeardownExplicitlyAsync()
Explicitly executes feature teardown. Call this from a manual cleanup method if needed.
protected Task ExecuteFeatureTeardownExplicitlyAsync()
Returns
Remarks
Due to xUnit's per-test instance model, feature teardown cannot be automatically triggered. If you need guaranteed cleanup, consider using IClassFixture or manually calling this method from a static cleanup mechanism.
InitializeAsync()
Executes feature setup (once per class) and background steps (per test).
public virtual Task InitializeAsync()