Selenium tests not building due to NUnit error (Mono+OS X)
- by Jem
I'm running Selenium RC on my Mac and driving my tests using NUnit in C#.
My problem is that when I try and build a simple test in Mono I get the following error.
Error CS0433: The imported type `NUnit.Framework.Assert' is defined multiple times (CS0433) (TestProject)
When I comment out the Assert's it runs fine.
The code I'm using currently is just a dump from the openqa site
using System;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using NUnit.Framework;
using Selenium;
namespace SeleniumTests
{
[TestFixture]
public class AllTests
{
private ISelenium selenium;
private StringBuilder verificationErrors;
[SetUp]
public void SetupTest ()
{
selenium = new DefaultSelenium ("localhost", 4444, "*safari", "http://www.google.co.uk");
selenium.Start ();
verificationErrors = new StringBuilder ();
}
[TearDown]
public void TeardownTest ()
{
try {
selenium.Stop ();
} catch (Exception) {
// Ignore errors if unable to close the browser
}
Assert.AreEqual ("", verificationErrors.ToString ());
}
[Test]
public void GoogleHomepageTests ()
{
// Open Google search engine.
selenium.Open ("http://www.google.com/");
// Assert Title of page.
Assert.AreEqual ("Google", selenium.GetTitle ());
// Provide search term as "Selenium OpenQA"
selenium.Type ("q", "Selenium OpenQA");
// Read the keyed search term and assert it.
Assert.AreEqual ("Selenium OpenQA", selenium.GetValue ("q"));
// Click on Search button.
selenium.Click ("btnG");
// Wait for page to load.
selenium.WaitForPageToLoad ("5000");
// Assert that "www.openqa.org" is available in search results.
Assert.IsTrue (selenium.IsTextPresent ("www.openqa.org"));
// Assert that page title is - "Selenium OpenQA - Google Search"
Assert.AreEqual ("Selenium OpenQA - Google Search", selenium.GetTitle ());
}
}
}
Any ideas? Is it a OSX/Mono thing?