Last active
March 1, 2016 09:29
-
-
Save gasparnagy/af63c543607b7b0a8dd4 to your computer and use it in GitHub Desktop.
Code examples for post: SpecFlow Tips: Put your hooks in order
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
[BeforeScenario(Order = 10)] | |
public void ResetDatabase() | |
{ | |
myDatabase.ResetToBaseline(); | |
} | |
[BeforeScenario("login", Order = 20)] | |
public void LoginAUser() | |
{ | |
loginPage.GoTo(); | |
loginPage.Submit("Tarzan", "pwd123"); | |
} |
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 class InitializationOrder | |
{ | |
public const int InitializeDatabase = 1; | |
public const int StartServices = 2; | |
public const int Authenticate = 3; | |
} | |
[BeforeScenario(Order = InitializationOrder.InitializeDatabase)] | |
public void ResetDatabase() | |
{ | |
myDatabase.ResetToBaseline(); | |
} |
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
[BeforeScenario] | |
public void ResetDatabase() | |
{ | |
myDatabase.ResetToBaseline(); // will this really be running before login? | |
} | |
[BeforeScenario("login")] | |
public void LoginAUser() | |
{ | |
loginPage.GoTo(); | |
loginPage.Submit("Tarzan", "pwd123"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment