21
I have defined [AfterScenario] binding in my stepdefinition class and have method which will be executed after each scenario, but from some reason this isn't working. My method isn't called after each scenario, so excel remains open after some tests... Also there is no log for some unsuccessful tests. Why? Do you have any idea or suggestions?
Here is my method:
[AfterScenario]
public void AfterScenario()
{
if (TestContext.CurrentContext.Result.State != TestState.Success) ErrorLog();
excelDriver.Stop();
}