2
votes

I installed SpecFlow and SpecRun recently on top of NUnit. I had a bit of trouble with references and Nuget packages but finally my tests run again. But this time whenever I run test (SpecFlow feature) my TestBase [SetUp] method once it reaches end runs again, resulting with opening browser window again. Test runs to the end with second attempt. Any one had similar problem?

I was checking solutions that point to PDB files as I see this popping up in Debug window but non seemed to work. Also, in Immediate Window I see this: Step into: Stepping over non-user code

I'm running test under recent version of SpecFlow v2.1.0 and NUnit3.21 against WebDriver v2.53.

1
Which hook of SpecFlow are you using for setup?Andreas Willich
[SetUp] [BeforeScenario] and [TearDown] [AfterScenario]. I'm using both for NUnit and SpecFlow.Jakubee
That is the problem. NUnit calls it once because if finds his attributes and SpecFlow calls in once because of the Hook- Attributes.Andreas Willich
I should leave NUnit hooks right?Jakubee
Do you have other NUnit tests/non SpecFlow that needs that code gets executed? If yes= take the NUnit Attributes, if no = take the SpecFlow AttributesAndreas Willich

1 Answers

2
votes

For future reference. NUnit and SpecFlow hooks are mutually exclusive. Make sure you run your tests with attributes specific for providers you want to run test with.