I have code that is something llike this:
public class SBase
{
protected IWebDriver driver;
[BeforeScenario()]
public void SetUp() {
driver = new ChromeDriver();
driver.Navigate().GoToUrl("http://abcd.com");
}
[AfterScenario()]
public void TearDown()
{
driver.Close();
driver.Quit();
}
}
I don't know why but when I run a test this happens: once the SetUp()
method finishes, then the SetUp()
method starts again and again without starting in the first step of the test.
[TestFixture]
public class SBase
{
protected IWebDriver driver;
[SetUp]
public void SetUp()
{
driver = new ChromeDriver();
driver.Navigate().GoToUrl("http://abcd.com");
}
[TearDown]
public void TearDown()
{
if (driver != null)
driver.Quit();
}
[Test]
public void Test1()
{
}
[Test]
public void Test2()
{
}
}
Try this