2012-03-27 32 views
8

Tengo un código C#. (Que se exporta de IDE selenio)El tipo o espacio de nombres 'NUnit' no se pudo encontrar

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"); 
} 
} 
} 

me pega este código en una aplicación de consola (Visual Studio 2008).
Después de correr, tengo esta errores:

El tipo o espacio de nombres 'NUnit' no se puede conocer.
El tipo o espacio de nombres 'TestFixture' no se puede conocer
El tipo o espacio de nombres 'ISelenium' no se pudo encontrar
El tipo o espacio de nombres 'SetUpAttribute' no se pudo encontrar

¿Qué marco debo agregar para corregir estos errores?

Respuesta

9

Parece como que tiene referencias que faltan. Desde oficial Selenium docs page:

agregar referencias a los siguientes DLL: nmock.dll, nunit.core.dll, nunit. framework.dll, ThoughtWorks.Selenium.Core.dll, ThoughtWorks.Selenium.IntegrationTests.dll y ThoughtWorks.Selenium.UnitTests.dll

Para su problema actual, es necesario hacer referencia a al menos NUnit.Framework. dll y selenio dlls.

Por favor lea la página de documentación para obtener más información.

+0

gracias consiguieron ... –

2

es necesario agregar una referencia a la DLL nUnit

+1

El DLL se llama nunit.framework.dll y se puede descargar desde el sitio web nUnit – TGH

+0

También necesita la DLL selenio (ThoughtWorks.Selenium.Core.dll) – TGH

+0

link para descargar thoughtworks.selenium.core.dll ?? No estoy recibiendo .. –

5

Haga clic derecho sobre las referencias en el explorador de soluciones y haga clic en Agregar referencia. Usted tendrá que buscar el nunit.framework.dll

+0

gracias por su ayuda .. lo tengo ... –

Cuestiones relacionadas