I'm having trivial question but what is the main different between static and non static driver/ NUnit hooks?
I'm having a code:
[TestClass]
public class SectionsTests
{
private static Driver _driver;
private static MainPage _mainPage;
private static CartPage _cartPage;
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
_driver = new LoggingDriver(new WebDriver());
_driver.Start(Browser.Chrome);
_mainPage = new MainPage(_driver);
_cartPage = new CartPage(_driver);
}
[ClassCleanup]
public static void ClassCleanup()
{
_driver.Quit();
}
[TestInitialize]
public void TestInitialize()
{
_mainPage.Open();
}
[TestMethod]
public void OpenBlogPage()
{
_mainPage.MainMenuSection.OpenBlogPage();
}
I'm facing different approaches, sometimes I see that QA's are using static hooks/ driver and some of those are using non static. What is the best approach to be taken?