Skip to content

Instantly share code, notes, and snippets.

@nadvolod
Created February 19, 2016 13:34
Show Gist options
  • Save nadvolod/8af1bb1dd39c5a684382 to your computer and use it in GitHub Desktop.
Save nadvolod/8af1bb1dd39c5a684382 to your computer and use it in GitHub Desktop.
Two parallel Nunit tests ready to be ran
using NUnit.Framework;
using OpenQA.Selenium.Firefox;
namespace ParallelLocal
{
[TestFixture]
[Parallelizable]
public class ParallelLocal
{
[Test]
public void Test1()
{
var driver = new FirefoxDriver();
driver.Navigate().GoToUrl("http://www.qtptutorial.net/automation-practice");
driver.Manage().Window.Maximize();
driver.FindElementById("idExample").Click();
var elementCheck = driver.FindElementByXPath("//p[contains(text(),'Button success')]").Displayed;
Assert.IsTrue(elementCheck, "Element was not present");
}
}
[TestFixture]
[Parallelizable]
public class ParallelLocal2
{
[Test]
public void Test2()
{
var driver = new FirefoxDriver();
driver.Navigate().GoToUrl("http://www.qtptutorial.net/automation-practice");
driver.Manage().Window.Maximize();
driver.FindElementByClassName("buttonClassExample").Click();
var elementCheck = driver.FindElementByXPath("//p[contains(text(),'Button success')]").Displayed;
Assert.IsFalse(elementCheck, "Element was not present");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment