NUnit 错误:不是测试程序集
我有一个包含 3 个项目的解决方案(一个是用于单元测试的 C# 类库,另一个是 MVC 2 Web 应用程序)
我已经包含了 NUnit 的所有必要引用,并且我已经用 < 正确地装饰了类和方法分别为 code>[TestFixture] 和 [Test]
。
它编译没有错误。
我正在使用 Visual Studio 2010 Pro
当我尝试在 NUnit 中打开 UnitTests.dll 时,出现以下错误:
不是测试组件。 该程序集不是使用任何已知的测试框架构建的。
I have a solution with 3 projects in it (one is a C# class-library for unit tests, another is a MVC 2 web application)
I have included all the necessary references for NUnit, and I have correctly decorated the classes and methods with [TestFixture]
and [Test]
respectively.
It compiles with no errors.
I am using Visual Studio 2010 Pro
When I try to open UnitTests.dll in NUnit, I get the following error:
Not a test assembly.
This assembly was not built with any known testing framework.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这可能是也可能不是您面临的问题,但我遇到了完全相同的问题,并且我发现我正在加载的 dll 是一个旧文件。
重建项目,然后实际进入 dll 所在的目录并检查它的创建/修改时间是否是最新的。
例如,创建起来非常简单:
如果您随后将 dll 加载到 my_project/unit-tests/ 中,您可能不会加载刚刚构建的 dll。
也尝试文件 ->在编辑测试类时另存为,并查看它被保存到的实际目录,并检查您正在加载的 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:
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.
是否提及 GAC 大会?看看工具>按照此博客文章测试 NUnit GUI 运行程序的程序集:
http://blog.solien.com/archive/2010/02/09/unable-to-load-unit-test-the- assembly-was-not.aspx< /a>
Is there a reference to the assembly in the GAC? Take a look in tools > test assemblies of the NUnit GUI runner as per this blog posting:
http://blog.solien.com/archive/2010/02/09/unable-to-load-unit-test-the-assembly-was-not.aspx