Consecutive verse Parallel Nunit Testing
- by Jacobm001
My office has roughly ~300 webpages that should be tested on a fairly regular basis. I'm working with Nunit, Selenium, and C# in Visual Studio 2010. I used this framework as a basis, and I do have a few working tests.
The problem I'm running into is is that when I run the entire suite. In each run, a random test(s) will fail. If they're run individually, they will all pass. My guess is that Nunit is trying to run all 7 tests at the same time and the browser can't support this for obvious reasons. Watching the browser visually, this does seem to be the case.
Looking at the screenshot below, I need to figure out a way in which the tests under Index_Tests are run sequentially, not in parallel.
errors:
Selenium2.OfficeClass.Tests.Index_Tests.index_4:
OpenQA.Selenium.NoSuchElementException : Unable to locate element: "method":"id","selector":"textSelectorName"}
Selenium2.OfficeClass.Tests.Index_Tests.index_7:
OpenQA.Selenium.NoSuchElementException : Unable to locate element: "method":"id","selector":"textSelectorName"}
example with one test:
using OpenQA.Selenium;
using NUnit.Framework;
namespace Selenium2.OfficeClass.Tests
{
[TestFixture]
public class Index_Tests : TestBase
{
public IWebDriver driver;
[TestFixtureSetUp]
public void TestFixtureSetUp()
{
driver = StartBrowser();
}
[TestFixtureTearDown]
public void TestFixtureTearDown()
{
driver.Quit();
}
[Test]
public void index_1()
{
OfficeClass index = new OfficeClass(driver);
index.Navigate("http://url_goeshere");
index.SendKeyID("txtFiscalYear", "input");
index.SendKeyID("txtIndex", "");
index.SendKeyID("txtActivity", "input");
index.ClickID("btnDisplay");
}
}
}