C# 在NUnit中实现TestSuite
我不断得到:C# 在NUnit中实现TestSuite,c#,selenium,nunit,C#,Selenium,Nunit,我不断得到: The type or namespace name 'TestSuite' could not be found (are you missing a using directive or an assembly reference?) 我使用VisualStudio2010,并通过NuGet安装了最新的NUnit和selenium参考。代码如下: using NUnit.Framework; namespace SeleniumTests { public clas
The type or namespace name 'TestSuite' could not be found (are you missing a using directive or an assembly reference?)
我使用VisualStudio2010,并通过NuGet安装了最新的NUnit和selenium参考。代码如下:
using NUnit.Framework;
namespace SeleniumTests
{
public class ManifestTestSuite
{
[Suite]
public static TestSuite Suite
{
get
{
TestSuite suite = new TestSuite("MyTestSuite");
suite.Add(new AddAll());
suite.Add(new RemoveAll());
return suite;
}
}
}
}
类存在于
nunit.core.dll
中,该类不随nuget包分发,因为通常不需要它
因此,您需要从下载“完整”nunit包,您可以在zip文件的lib文件夹中找到nunit.core.dll
然而,您不需要这样做,因为自2.4.4以来有了一种新的方法,如中所述:您可以返回测试数组,而不是实例TestSuite
:
[Suite]
public static IEnumerable Suite
{
get
{
ArrayList suite = new ArrayList();
suite.Add(new AddAll());
suite.Add(new RemoveAll());
return suite;
}
}