I've seen several approaches to instantiate web driver in Specflow examples.
- Creating it in the steps definition class and disposing it in
Disposemethod for the class
Why is it horrible? Cause 1 scenario doesn't equal 1 steps definition class as some steps are just shared between features and there will be more than 1 web driver instantiated. Example: https://www.softwaretestinghelp.com/specflow-and-selenium/
- Creating it in hooks
[BeforeScenario]and destroying int in[AfterScenario]
It won't work with parallel execution(according to author). https://github.com/AutomateThePlanet/AutomateThePlanet-Learning-Series/tree/master/Specflow-Series/ExtendTestExecutionWorkflowUsingHooks
Question: How to manage WebDriver instances in Specflow UI tests solution with NUnit? Where and when initialize it, where and when destroy and how to access it in page object models and steps definition classes?