NUnit namespace type or name could not be found

I have C # code (which is exported from Selenium IDE)

using System; using System.Text; using System.Text.RegularExpressions; using System.Threading; using NUnit.Framework; using Selenium; namespace SeleniumTests { [TestFixture] public class csharp { private ISelenium selenium; private StringBuilder verificationErrors; [SetUp] public void SetupTest() { selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://localhost:1924/"); 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 TheCsharpTest() { selenium.Open("/cookie/Default.aspx"); selenium.Type("id=TextBox1", "ranadheer"); selenium.Type("id=TextBox2", "SE"); selenium.Type("id=TextBox3", "hyderabad"); selenium.Click("id=Button1"); selenium.WaitForPageToLoad("30000"); selenium.Click("id=Button2"); selenium.WaitForPageToLoad("30000"); } } } 

I pasted this code into a console application (visual studio 2008).
After starting, I received the following errors:

Cannot find name of type or NUnit namespace. The type or namespace name "TestFixture" was not found. The type or namespace name "ISelenium" was not found. Type or namespace name 'SetUpAttribute' could not be found

What structure should be added to correct these errors?

+8
c # frameworks selenium
source share
3 answers

You seem to be missing links. From the official Selenium docs page :

Add links to the following DLLs: nmock.dll, nunit.core.dll, NUnit. framework.dll, ThoughtWorks.Selenium.Core.dll, ThoughtWorks.Selenium.IntegrationTests.dll and ThoughtWorks.Selenium.UnitTests.dll

For your current problem, you need to refer to at least the NUnit.Framework.dll and Selenium files.

Read more on the documentation page.

+9
source share

Right-click the links in Solution Explorer and click the link. You will need to find nunit.framework.dll

+5
source share

You need to add a link to dll NUNIT

+2
source share

All Articles