问题
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.
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?
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
回答1:
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.
You can test it...
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.
来源:https://stackoverflow.com/questions/29344903/nunit-extension-does-not-work-running-tests-through-the-nunit-gui