[BeforeTestRun] and [AfterTestRun] blocks runs for every Test cases in single execution cycle
Hi Team,
I am using Specflow + VS 2019 + + Selenium + nUnit on MAC OS. I have encountered an issue where [BeforeTestRun] and [AfterTestRun] blocks runs for every Test cases in single execution cycle. Lets Say I have ran 2 TCs for one cycle in sequential order( Not in parallel) then execution will be [BeforeTestRun] >> TC1 >> [AfterTestRun] and then again it starts with [BeforeTestRun] >> TC2 >> [AfterTestRun]. Ideally [BeforeTestRun] and [AfterTestRun] should gets executed only once per execution cycle.
Note: It is working as expected in Windows OS.
I am using below packages
PackageReference Include="ExtentReports" Version="5.0.0-alpha6" />
PackageReference Include="NUnit" Version="3.13.3" />
PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
PackageReference Include="SpecFlow" Version="3.9.74" />
PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.9.74" />
PackageReference Include="SpecFlow.NUnit" Version="3.9.74" />
PackageReference Include="Selenium.WebDriver" Version="4.5.1" />
PackageReference Include="Selenium.Support" Version="4.5.1" />
PackageReference Include="log4net" Version="2.0.15" />
PackageReference Include="SeleniumExtras.WaitHelpers" Version="1.0.2" />
Kindly help me to resolve the issue. Not sure whether it is an issue with Specflow or nUnit as [OnetimeSetup] and [OneTimeTearDown] block in nUnit.AssemblyHooks.cs is also getting executed with every scenarios, ideally this also should be run only once per execution.
Please sign in to leave a comment.
Comments
0 comments