nunit-console无法定位固定装置 [英] nunit-console can not loacte fixture
问题描述
我有2.5.8和VS2010
I have 2.5.8 and VS2010
我想针对dll运行测试,如果我输入
I want to run tests against a dll and if I type
nunit-console a.dll
nunit-console a.dll
我也有这些套房
public class AllTests
{
[Suite]
public static IEnumerable Suite
{
get
{
List<Type> suite = new List<Type>();
foreach (Type testCase in UnitTests.Suite)
{
suite.Add(testCase);
}
return suite;
}
}
}
和
public class UnitTests
{
[Suite]
public static IEnumerable Suite
{
get
{
List<Type> suite = new List<Type>();
suite.Add(typeof(LicenceManagerTests));
suite.Add(typeof(CertManagerTests));
return suite;
}
}
}
如果我想使用输入的套件运行测试
If I would like to run tests using Suites I type
nunit-console a.dll/fixture=AllTests.Suite
nunit-console a.dll /fixture=AllTests.Suite
但失败,并显示消息
无法找到夹具AllTests.Suite
Unable to locate fixture AllTests.Suite
如果您怀疑我为什么使用Suites,我不知道.我们正在项目中使用MSBuild,我猜这是MSBuild的要求.
If you wonder why I use Suites ,I don't know. We are using MSBuild in our project and this is a requirement of MSBuild I guess.
任何帮助表示赞赏.问候.
Any help appreciated. Regards.
推荐答案
我找到了解决方案.
诀窍是名称空间. alltests和unittests类的命名空间应为
The trick is namespace. Namespace of alltests and unittests classes should be
"Suites".
否则,我会不断收到无法找到"的信息. 问候
Otherwise I keep receving "unable to locate".. Regards
这篇关于nunit-console无法定位固定装置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!