Created
November 6, 2017 20:24
-
-
Save laribee/0e721f124c4533b93929eb0c90675fa3 to your computer and use it in GitHub Desktop.
Test-per-scenario with SpecFlow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Example | |
Can we bypass step definitions and use a single test | |
fixture instead? Yes we can! | |
Scenario: Spike | |
Now I can explain my scenario and examples | |
outside of the somewhat restrictive GWT-type | |
language. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Binding] | |
[Scope(Feature = "Example", Scenario = "Spike")] | |
public class ExampleSteps : TestPerScenario | |
{ | |
protected override void Scenario() | |
{ | |
// Given OR Arrange | |
// When OR Act | |
// Then OR Assert | |
Assert.True(false); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class TestPerScenario | |
{ | |
[StepDefinition(@"(.*)")] | |
public void AllSteps(string stepName) | |
{ | |
// maybe do something with stepName | |
} | |
[AfterScenario()] | |
public virtual void Hook() | |
{ | |
Scenario(); | |
} | |
protected abstract void Scenario(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment