Created
June 27, 2012 14:22
-
-
Save stuartf7/3004358 to your computer and use it in GitHub Desktop.
Example Fixture Setup For Selenium Testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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