Hooks class for SpecFlow parallelization
This file contains 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] | |
public class Hooks | |
{ | |
public IWebDriver Driver { get; } | |
private readonly ScenarioContext _scenarioContext; | |
public Hooks(IWebDriver driver, ScenarioContext scenarioContext) | |
{ | |
Driver = driver; | |
_scenarioContext = scenarioContext; | |
} | |
[AfterScenario] | |
public void Teardown() | |
{ | |
if (Driver == null){ return; } | |
var passed = _scenarioContext.ScenarioExecutionStatus == ScenarioExecutionStatus.OK; | |
((IJavaScriptExecutor)Driver).ExecuteScript("sauce:job-result=" + (passed ? "passed" : "failed")); | |
Driver.Quit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment