My [BeforeTestRun] and [AfterTestRun] bindings are not being executed, while the [BeforeScenario], [AfterStep] and [AfterScenario] is being executed. From this class the first binding that is executed is [BeforeScenario]. I am kind of clueless why the [BeforeTestRun] and [AfterTestRun] are being ignored.
[BeforeTestRun] code:
[BeforeTestRun]
public static void TestInitialize()
{
var htmlReporter = new ExtentHtmlReporter(@"D:\\ExtentReport\\");
extent = new AventStack.ExtentReports.ExtentReports();
extent.AttachReporter(htmlReporter);
}
[AfterTestRun] code:
[AfterTestRun]
public static void CleanUp()
{
extent.Flush();
}
While this code ([AfterStep] and [BeforeScenario]) is being executed:
[BeforeScenario]
public void BeforeScenario()
{
InitializeSettings();
featureName = extent.CreateTest<Feature>(_featureContext.FeatureInfo.Title);
scenario = featureName.CreateNode<Scenario>(_scenarioContext.ScenarioInfo.Title);
}
[AfterStep]
public void InsertReportingSteps()
{
var stepName = _scenarioContext.StepContext.StepInfo.Text;
var featureName = _featureContext.FeatureInfo.Title;
var scenarioName = _scenarioContext.ScenarioInfo.Title;
var stepType = _scenarioContext.StepContext.StepInfo.StepDefinitionType.ToString();
if (_scenarioContext.TestError == null)
.....[etc..]
}
Does anyone have any clue as to why my BeforeTestRun and AfterTestRun bindings are not being executed? We are using NUnit3. All bindings are in the same HookInitialize.cs class.
Specflow version 3.4.8
Specflow.NUnit version 3.4.8
NUnit version 3.12.0
NUnit3TestAdapter version 3.17.0
Aucun commentaire:
Enregistrer un commentaire