lundi 23 mars 2015

NUnit extension works fine running tests in VS but don't through NUnit GUI

As my post subject suggests, I have a problem with my NUnit extension/addin. I have created a test project (named UTProject) in Visual Studio 2013, and for an integrated test execution under VS I have used the NUnit Test Adapter in my project (through the VS Packet Manager: PM> Install-Package NUnitTestAdapter).


At first all my tests work fine but then I have decided to log the whole execution, in particular I wanted to log all the errors... to do that I've add the ExtensionToLog.cs class to UTProject. This class implements both IAddin and EventListener:



[NUnitAddinAttribute(Type = ExtensionType.Core)]
public class ExtensionToLog: IAddin, EventListener
{
...
}


In this class I have implemented the bool Install(IExtensionHost host) method and I have modified the behaviour of some methods such as void TestFinished(TestResult result) or void SuiteFinished(TestResult result) in order to create the Log.xml file.


Here is my problem: if I run my tests using Visual Studio all my tests work fine and at the end of the execution the resulting log file is printed... If I run my tests through the NUnit Gui my tests work fine but the log file is not printed (Also each Console.WriteLine instruction that I have coded inside the extension class, when I test by using the NUnit Gui, is not printed... ). How can I reach the same expected behaviour in both testing situations??? Am I forgetting something?


Please note that if I copy the UTProject.dll file inside the C:\Program Files (x86)\NUnit 2.6.4\bin\addins folder and then I try in NUnit to show it (Tools-->Addins) I can't do that: nothing is displayed inside the Addins window.


PS: another related question is "If I create, through NUnit.exe, a new .nunit project, have I to select the assembly that is inside the NUnit\addins folder or the .dll that is inside my bin folder when I have to add the assembly to that .nunit project?".


I'm using the 2.6.4 NUnit version.


Aucun commentaire:

Enregistrer un commentaire