Skip to content

Attribute to reduce duplicate stepTextTemplate definitions #107

@jason-roberts

Description

@jason-roberts

Is there a way to stop repetition of stepTextTemplate format strings, I know they could be stored in a field in the test class etc but wondering if there would by any added value to creating something like a [StepTextTemapate] attr? Just thinking out loud :)

rather than
.When(x => WhenIAdd(8), "When I add {0} to it")
.When(x => WhenIAdd(42), "When I add {0} to it")
.When(x => WhenIAdd(99), "When I add {0} to it")

where:

private void WhenIAdd(int num) ...

instead:

.When(x => WhenIAdd(8))
.When(x => WhenIAdd(42))
.When(x => WhenIAdd(99))

where:

[StepTextTemplate("When I add {0} to it")]
private void WhenIAdd(int num) ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions