NUnit 扩展无法通过 NUnit GUI 运行测试 [英] NUnit extension does not work running tests through the NUnit GUI

查看:34
本文介绍了NUnit 扩展无法通过 NUnit GUI 运行测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 NUnit Visual Studio 测试适配器和我创建的框架扩展类时遇到了一些问题.特别是我的解决方案有 2 个项目:第一个是包含一些我必须测试的方法的类库,第二个是测试程序集.这个程序集包括扩展类(我没有将相关的 dll 添加到 NUnit 程序目录内的 addin 文件夹中,因为该扩展类是专门为此程序集创建的)我创建的用于获取和使用断言失败消息.

I have some problem to use both the NUnit Visual Studio Test Adapter and a framework extension class I've created. In particular my solution has 2 projects: the first one is a class library that contains some methods I must test and the second one is the test assembly. This assembly includes the extension class (I don't add the related dll to the addin folder inside the NUnit program directory because that extension class has been created exclusively for this assembly) that I have created to get and use the assertion failure messages.

问题:我想要一个 BIN 文件夹(在我的解决方案文件夹旁边)放置我需要的所有 DLL,并使用这个 BIN 文件夹从 Visual Studio 运行我的测试(这就是为什么我需要 NUnit Visual Studio 测试适配器)并通过NUnit-x86.exe 程序(我的意思是通过 NUnit GUI).目前我只能通过从 Visual Studio 运行它们来正确运行我的所有测试......通过 NUnit GUI 扩展类不起作用(我的意思是我的扩展是不可见的,我不是说有什么东西可以错误).

Question: I would like to have a BIN folder (next to my solution folder) where place all the DLLs I need, and use this BIN folder to run my tests from Visual Studio (that is why I need the NUnit Visual Studio Test Adapter) and through the NUnit-x86.exe program (I mean through the NUnit GUI). At the moment I can run correctly all my test only by running them from Visual Studio... through the NUnit GUI the extension class does not work (I mean that my extension is invisible, I don't mean that there is something that gets error).

我必须如何设置我的项目?

How do I have to set my project?

额外信息:我在 64 位机器上使用 NUnit 2.6.4 和 VS 2013 Professional.为了使用测试适配器,我遵循了这个指南

Extra info: I'm using NUnit 2.6.4 and VS 2013 Professional on a 64bit machine. To use the test adapter I followed this guide

推荐答案

好的,现在我知道问题出在哪里了.在 64 位机器上,如果要使用 NUnit GUI,则必须使用 nunit-x86.exe 程序;如果你想在运行 NUnit GUI 时使用你的扩展,那么它需要 3 个特定的 DLL(nunit.core.dllnunit.core.interfaces.dllnunit.util.dll) 位于 C:\Program Files(x86)\NUnit2.6.4\...lib 文件夹中.这 3 个 DLL 与在 Visual Studio 中运行测试程序所需的 DLL 不同.Visual Studio 将使用通过安装 NUnit 测试适配器获得的 DLL.DLL 名称相同,但一组与 x86 相关,另一个 DLL 设置为 64 位.

OK, now I know what is the problem. On a 64bit machine if you want to use the NUnit GUI you must use the nunit-x86.exe program; if you want to use your extension when you run the NUnit GUI then it needs 3 specific DLLs (nunit.core.dll, nunit.core.interfaces.dll, nunit.util.dll) located in the lib folder in C:\Program Files(x86)\NUnit2.6.4\.... These 3 DLLs are not the same DLLs that you need to run your test program in Visual Studio. Visual Studio will use the DLLs obtained through the installation of the NUnit Test Adapter. The DLLs names are the same but a set is related to x86, the other one DLLs set to 64bit.

你可以测试一下...

将位于 C:\Program Files(x86)\NUnit2.6.4\bin\lib 中的 DLLS 用于 Visual Studio...不会发生与您的扩展相关的任何事情.当您使用测试适配器安装"的 DLL 运行程序时,NUnit GUI 也是如此.

Use the DLLS located in C:\Program Files(x86)\NUnit2.6.4\bin\lib for Visual Studio... nothing related to your extension will happen. The same for NUnit GUI when you run the program using the DLLs that have been ''installed'' by the Test Adapter.

这篇关于NUnit 扩展无法通过 NUnit GUI 运行测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆