Skip to content

Instantly share code, notes, and snippets.

@stuartf7
Created June 27, 2012 14:22
Show Gist options
  • Save stuartf7/3004358 to your computer and use it in GitHub Desktop.
Save stuartf7/3004358 to your computer and use it in GitHub Desktop.
Example Fixture Setup For Selenium Testing
using System;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
namespace selenium_examples
{
[TestFixture]
public class GoogleTests
{
private IWebDriver _driver;
[TestFixtureSetUp]
public void FixtureSetup()
{
_driver = new ChromeDriver();
_driver.Manage().Timeouts().ImplicitlyWait(new TimeSpan(0, 0, 30));
}
[SetUp]
public void TestSetUp()
{
_driver.Navigate().GoToUrl("http://www.google.co.uk");
}
[TestFixtureTearDown]
public void FixtureTearDown()
{
if (_driver != null) _driver.Close();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment