nunit-console 不会 运行 任何测试
nunit-console won't run any tests
我正在通过 Mono 测试驱动 .Net 生态系统,但我 运行 遇到了 NUnit 的问题。我有以下示例测试文件:
using NUnit.Framework;
namespace Tests
{
[TestFixture]
class Tests
{
[Test]
public void FailingTest()
{
Assert.Fail("A message");
}
[Test]
public void PassingTest()
{
}
}
}
我正在构建并且 运行宁通过:
cweber@mbp ~/temp/monoexample$ dmcs tests.cs -target:library -r:$NUNIT_FRAMEWORK_DLL
cweber@mbp ~/temp/monoexample$ ls tests.dll
tests.dll
cweber@mbp ~/temp/monoexample$ nunit-console tests.dll
NUnit version 2.4.8
Copyright (C) 2002-2007 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.
Runtime Environment -
OS Version: Unix 14.5.0.0
CLR Version: 4.0.30319.17020 ( 4.2.1 (explicit/6dd2d0d Fri Nov 6 12:25:19 EST 2015) )
.N.N
Tests run: 0, Failures: 0, Not run: 2, Time: 0.014 seconds
如您所见,这两个测试都不是 运行ning。
我用谷歌搜索了所有我能想到的东西,并且我已经完成了所有我能想到的实验(例如,删除命名空间,弄乱 fixture
和 run
标志, ETC)。我已经尽我所能清楚地简化了这个示例,但是我 运行 没有想法。如果我能提供更多信息,请告诉我!
如果答案很明显,我很抱歉问这个问题。
查看您的 TestResult.xml
文件,您会发现原因,class 不是 public ;-)
<results>
<test-case name="Tests.Tests.FailingTest" executed="False">
<reason>
<message><![CDATA[Fixture class is not public]]></message>
</reason>
</test-case>
<test-case name="Tests.Tests.PassingTest" executed="False">
<reason>
<message><![CDATA[Fixture class is not public]]></message>
</reason>
</test-case>
</results>
我正在通过 Mono 测试驱动 .Net 生态系统,但我 运行 遇到了 NUnit 的问题。我有以下示例测试文件:
using NUnit.Framework;
namespace Tests
{
[TestFixture]
class Tests
{
[Test]
public void FailingTest()
{
Assert.Fail("A message");
}
[Test]
public void PassingTest()
{
}
}
}
我正在构建并且 运行宁通过:
cweber@mbp ~/temp/monoexample$ dmcs tests.cs -target:library -r:$NUNIT_FRAMEWORK_DLL
cweber@mbp ~/temp/monoexample$ ls tests.dll
tests.dll
cweber@mbp ~/temp/monoexample$ nunit-console tests.dll
NUnit version 2.4.8
Copyright (C) 2002-2007 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.
Runtime Environment -
OS Version: Unix 14.5.0.0
CLR Version: 4.0.30319.17020 ( 4.2.1 (explicit/6dd2d0d Fri Nov 6 12:25:19 EST 2015) )
.N.N
Tests run: 0, Failures: 0, Not run: 2, Time: 0.014 seconds
如您所见,这两个测试都不是 运行ning。
我用谷歌搜索了所有我能想到的东西,并且我已经完成了所有我能想到的实验(例如,删除命名空间,弄乱 fixture
和 run
标志, ETC)。我已经尽我所能清楚地简化了这个示例,但是我 运行 没有想法。如果我能提供更多信息,请告诉我!
如果答案很明显,我很抱歉问这个问题。
查看您的 TestResult.xml
文件,您会发现原因,class 不是 public ;-)
<results>
<test-case name="Tests.Tests.FailingTest" executed="False">
<reason>
<message><![CDATA[Fixture class is not public]]></message>
</reason>
</test-case>
<test-case name="Tests.Tests.PassingTest" executed="False">
<reason>
<message><![CDATA[Fixture class is not public]]></message>
</reason>
</test-case>
</results>