本文介绍了NUnit的错误:没有一个测试组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有在这3个项目的解决方案(一个是C#类库单元测试,另一种是MVC 2 Web应用程序)

我已经包括了所有的NUnit必要的参考,我已经正确装饰类和方法与 [的TestFixture] [测试] 分别。

它编译没有任何错误。

我使用Visual Studio 2010专业版

当我尝试在NUnit的打开UnitTests.dll,我得到以下错误:

解决方案

This may or may not be the issue that you are facing, but I had exactly the same issue and I found that the dll I was loading was an old file.

Rebuild the project and then actually go into the directory that the dll is in and check that it has a creation/modification time that is current.

It's very easy, for example, to create:

my_project/
my_project/domain/
my_project/unit-tests/ (removed but not deleted on the HD, not visible in studio)
my_project/domain/unit-tests/ (visible as MyProject.UnitTests)

If you then load the dll in my_project/unit-tests/ you may not be loading the dll you just built.

Try also file -> save as while editing a test class, and see what actual directory it is being saved into, and check that the dll you are loading is from the same path.

这篇关于NUnit的错误:没有一个测试组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 15:26