Skip to content

Instantly share code, notes, and snippets.

@ultimate-qa2
Created February 14, 2021 09:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Hooks class for SpecFlow parallelization
[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