Search code examples
scopeautomated-testsspecflowfeature-selectionfeature-file

Multiple Scope value in Binding (Specflow)


I have a method which runs Before a feature like so,

[BeforeFeature, Scope(Feature = "Feature1"]
Method()
{
}

I want the same method to be ran for another feature file that i've wiritten i.e. Feature2

How do i combine this "Feature2" in the scope Binding?

I tried this

[BeforeFeature, Scope(Feature = "Feature1"]
[Scope(Feature="Feature2")]

but didn't work. The method only runs for Feature1 and not for Feature2


Solution

  • According to the scoping rules multiple Scope bindings will be OR'd so I would expect the second example to work. Are you sure that you are spelling the feature name correctly?

    I'll try and get an example worked up to verify this behaviour.