Table of Contents

Class ScenarioAttribute

Namespace
TinyBDD
Assembly
TinyBDD.dll

Marks a test method as a BDD Scenario, optionally providing a friendly name and tags.

[AttributeUsage(AttributeTargets.Method, Inherited = false)]
public sealed class ScenarioAttribute : Attribute
Inheritance
ScenarioAttribute
Inherited Members

Examples

[Feature("Checkout")]
public class CheckoutTests
{
    [Scenario("Successful purchase", "happy-path", "checkout")]
    public async Task Purchase_Succeeds() { /* ... */ }
}

Remarks

The attribute is read by CreateContext(object, string?, ITraitBridge?, ScenarioOptions?) to resolve the scenario name and to collect tags alongside any TagAttributes.

Constructors

ScenarioAttribute(string?, params string[]?)

Marks a test method as a BDD Scenario, optionally providing a friendly name and tags.

public ScenarioAttribute(string? name = null, params string[]? tags)

Parameters

name string
tags string[]

Examples

[Feature("Checkout")]
public class CheckoutTests
{
    [Scenario("Successful purchase", "happy-path", "checkout")]
    public async Task Purchase_Succeeds() { /* ... */ }
}

Remarks

The attribute is read by CreateContext(object, string?, ITraitBridge?, ScenarioOptions?) to resolve the scenario name and to collect tags alongside any TagAttributes.

See Also

Properties

Name

Optional scenario name shown in reports; falls back to the method name when omitted.

public string? Name { get; }

Property Value

string

Tags

Optional tags associated with the scenario.

public string[] Tags { get; }

Property Value

string[]

See Also