我有一个简单的NUnit代码不起作用,如下所示:
[TestFixture("abc","xyz",typeof(int))]
public class GenericTestFixture<T>
{
T tt;
string aa;
string bb;
public GenericTestFixture(string a,string b,T t)
{
tt = t;
aa = a;
bb = b;
}
[Test]
public void Test1()
{
Debug.WriteLine($"aa is {aa},bb is {bb},t is {typeof(T).ToString()}");
}
[TestCase(1)]
public void TestMethod(int c)
{
Assert.Equals(c,1);
}
}
由于某种原因,在单击测试浏览器中的“运行”按钮后,我收到了“结果为2,未运行”消息,然后在构造函数中放置了一个断点并尝试调试,但未按预期停止。是什么原因以及如何解决?我的NUnit版本是3.12.0,NUnit3TestAdapter版本是3.15.1
UPDATE1
我转到输出窗口并获得以下日志消息:
[11/5/2019 8:21:40.468 PM Informational] Skipping assembly - no matching test cases found
[11/5/2019 8:21:40.743 PM Informational] NUnit Adapter 3.15.1.0: Test execution complete
[11/5/2019 8:21:40.815 PM Warning] No test matches the given testcase filter `FullyQualifiedName=DataDrivenTests.GenericTestFixture.Test1|FullyQualifiedName=DataDrivenTests.GenericTestFixture.TestMethod` in D:\code\NUnit_practice\nunit-csharp-samples\DataDrivenTests\bin\Debug\DataDriven.Tests.dll
[11/5/2019 8:21:42.752 PM Informational] ========== Run finished: 0 tests run (0:00:06.1448651) ==========