Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Hooks class for SpecFlow parallelization
public class Hooks
public IWebDriver Driver { get; }
private readonly ScenarioContext _scenarioContext;
public Hooks(IWebDriver driver, ScenarioContext scenarioContext)
Driver = driver;
_scenarioContext = scenarioContext;
public void Teardown()
if (Driver == null){ return; }
var passed = _scenarioContext.ScenarioExecutionStatus == ScenarioExecutionStatus.OK;
((IJavaScriptExecutor)Driver).ExecuteScript("sauce:job-result=" + (passed ? "passed" : "failed"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment