类型或命名空间名称'NUnit的'找不到 [英] The type or namespace name 'NUnit' could not be found

查看:2058
本文介绍了类型或命名空间名称'NUnit的'找不到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个C#代码(这是从硒IDE导出)

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



我在粘贴此代码。控制台应用程序(Visual Studio 2008的)结果
运行后,我得到这个错误:

I pasted this code in a console application (visual studio 2008).
After running, I got this errors:

类型或命名空间名称NUnit的'不能被发现。结果
类型或命名空间名称'的TestFixture找不到结果
类型或命名空间名称'ISelenium找不到结果
中的类型或命名空间名称SetUpAttribute无法找到

The type or namespace name 'NUnit' could not be found.
The type or namespace name 'TestFixture' could not be found
The type or namespace name 'ISelenium' could not be found
The type or namespace name 'SetUpAttribute' could not be found

我要补充什么框架,以纠正这种错误?

What framework should I add to correct this errors?

推荐答案

好像你有参考失踪。来自官方的硒文档页面

It seems like you have references missing. From official Selenium docs page:

添加对下列DLL:nmock.dll,nunit.core.dll程序,
NUnit的。 framework.dll,ThoughtWorks.Selenium.Core.dll,
ThoughtWorks.Selenium.IntegrationTests.dll和
ThoughtWorks.Selenium.UnitTests.dll

Add references 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

有关当前的问题,你需要至少引用nunit.framework.dll中硒的DLL。

For your current problem, you need to reference at least NUnit.Framework.dll and Selenium dlls.

请阅读更多的文档页面信息。

Please read the docs page for more info.

这篇关于类型或命名空间名称'NUnit的'找不到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆