0 votes
1 view
in Devops and Agile by (19.8k points)

I'm looking for the recommended/nicest way to make Selenium tests execute in several browsers one after another. The website I'm testing isn't big, so I don't need a parallel solution yet.

I have the usual test set-up methods with  [SetUp], [TearDown], and [Test]. The SetUp one, of course, instantiates a new ISelenium object with whatever browser I want to test with.

So what I want to do is programmatically say: this test will be run on Chrome, IE, and Firefox in sequence. How do I do that?


This might help a bit. We're using CruiseControl.NET to start the NUnit tests after a successful build. Is there any way to pass a parameter to the NUnit executable, and then use that parameter in the test? This way we could have NUnit run several times with different browser parameters.

1 Answer

0 votes
by (63.4k points)

NUnit 2.5+ now supports Generic Test Fixtures which make testing in multiple browsers very straightforward.


Running the following example will execute the GoogleTest twice, once in Firefox and once in IE.

using NUnit.Framework;

using OpenQA.Selenium;

using OpenQA.Selenium.Firefox;

using OpenQA.Selenium.IE;

using System.Threading;

namespace SeleniumTests




   public class TestWithMultipleBrowsers<TWebDriver> where TWebDriver : IWebDriver, new()


       private IWebDriver driver;


       public void CreateDriver () {

           this.driver = new TWebDriver();



       public void GoogleTest() {


           IWebElement query = driver.FindElement(By.Name("q"));

           query.SendKeys("Bread" + Keys.Enter);


           Assert.AreEqual("bread - Google Search", driver.Title);



Welcome to Intellipaat Community. Get your technical queries answered by top developers !