【发布时间】:2018-03-26 16:06:04
【问题描述】:
我使用的是最新的 VS2017 版本 15.6.4、NUnit3TestAdapter 3.10.0 和 Nunit 版本 3.9.0.0。
当我尝试在测试资源管理器中运行单元测试时,测试显示为灰色,当我右键单击并运行选定的测试时,我看到以下错误:没有可用的测试 这是我的测试类的样子
[TestFixture]
public partial class ListViewBOTest
{
[Test]
public void TestSearch_DateTime()
{
Assert.AreEqual(1,0);
}
}
输出文本:
[3/26/2018 10:53:55 AM Informational] ------ Run test started ------
[3/26/2018 10:53:55 AM Informational] NUnit Adapter 3.10.0.21: Test execution started
[3/26/2018 10:53:55 AM Informational] Running all tests in C:\Projects\MVPPlant\DEV\CMMSdg.Plant\CMMSdg.Plant\Sln.2010\CMMSdg.Plant.BusinessObjects.Test\bin\Debug\CMMSdg.Plant.BusinessObjects.Test.dll
[3/26/2018 10:53:56 AM Informational] NUnit failed to load C:\Projects\MVPPlant\DEV\CMMSdg.Plant\CMMSdg.Plant\Sln.2010\CMMSdg.Plant.BusinessObjects.Test\bin\Debug\CMMSdg.Plant.BusinessObjects.Test.dll
[3/26/2018 10:53:56 AM Informational] NUnit Adapter 3.10.0.21: Test execution complete
[3/26/2018 10:53:56 AM Warning] No test is available in C:\Projects\MVPPlant\DEV\CMMSdg.Plant\CMMSdg.Plant\Sln.2010\CMMSdg.Plant.BusinessObjects.Test\bin\Debug\CMMSdg.Plant.BusinessObjects.Test.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
[3/26/2018 10:53:56 AM Informational] ========== Run test finished: 0 run (0:00:01.0435303) ==========
【问题讨论】:
-
只是因为我没有看到它在屏幕截图中也没有提到,我只是想仔细检查一下你的类顶部是否有
[TextFixture]属性,其中包含测试方法是吗? -
是的,我有。我刚刚添加了一个示例测试。
-
更新:评论解决方案中的单元测试类之一解决了问题。我仍然不知道该课程出了什么问题。仍在调查中。一旦我确定了问题所在,我将发布解决方案。
-
@JoakimM.H。这是 2015 年的要求。它最近被编辑。
标签: c# visual-studio visual-studio-2017 nunit