PDA

View Full Version : NUnit running from NCover issue


teognost
11-22-2006, 11:51 AM
Currently we have a NANT build and we intend to migrate to VisBuild.
In Nant build unit tests are run from Ncover -by launching Ncover this way:
"C:\Program Files\NCover\NCover.console.exe" "C:\Program Files\NUnit-Net-2.0 2.2.8\bin\nunit-console.exe" "XTests.dll" /noshadow //a "XTests" //ea "XA1;XA2"
and everything is ok(working dir is some E:\NGUnitTests).
XTests.dll is the tested assembly,XTests is the profiled namespace ,XA1 and XA2 are attributes to be excluded from tests.


In order to do the same in VisBuild I did this:
-created a NCover action
-In Input tab I have set:
Mode->Executable
Exec+Param->"C:\Program Files\NUnit-Net-2.0 2.2.8\bin\nunit-console.exe"
Working dir->E:\NGUnitTests
List of assemblies to profile->XTests.dll
Classes and methodes to exclude->XA1 on one line,XA2 on another line.
-In Output tab I have set:
Profile log file->%NG_UNIT_TESTS_DIR%\Results\NCover\Coverage.log
Coverage output file->%NG_UNIT_TESTS_DIR%\Results\Ncover\Coverage.xml
-In Option tab I have ticked the checkbox 'Show command line ...'
When running this action I would expect to see Ncover is launched in similar way with NANT.
Instead it is launched like this:
"C:\Program Files\NCover\NCover.Console.exe" "C:\Program Files\NUnit-Net-2.0 2.2.8\bin\nunit-console.exe" //w E:\NGUnitTests //l E:\NGUnitTests\Results\NCover\Coverage.log //x E:\NGUnitTests\Results\Ncover\Coverage.xml

so no mention of profiled assemblies nor of excluded attributes.
Also I see you cannot set the profiled namespaces for this step?

Because of this the step fails-as it is in the output of the step:

Command: C:\Program Files\NUnit-Net-2.0 2.2.8\bin\nunit-console.exe
Command Args:
Working Directory: E:\NGUnitTests
Assemblies:
Coverage Xml: E:\NGUnitTests\Results\Ncover\Coverage.xml
Coverage Log: E:\NGUnitTests\Results\NCover\Coverage.log

Waiting for profiled application to connect...Connected
Configuring Profiler...
******************* Program Output *******************
NUnit version 2.2.8
Copyright (C) 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole.
Copyright (C) 2000-2003 Philip Craig.
All Rights Reserved.

OS Version: Microsoft Windows NT 5.1.2600 Service Pack 2 .NET Version: 2.0.50727.42

fatal error: no inputs specified


Could you please tell me what I did wrong when setting this Ncover action?
Also how can I set the profiled namespaces?
I would like to have the same results like in NANT.
Thanks

kevina
11-24-2006, 10:53 AM
You have uncovered a bug in the NCover action, attached is a fix for this problem. Replace the NCover.action file, found in the Actions folder of your VBP install folder - by default c:\program files\visbuildpro6\Actions with the updated file (zipped in attached NCover.zip).

To pass the /noshadow flag, just add it to the Additional options: field on the Options tab.

This bug fix will be included in a future updated build of Visual Build Professional v.6.

teognost
11-24-2006, 02:36 PM
I have followed your indications-initially it did not work but after I made some changes into action-it works ok.
I needed to set the action this way:
In Input tab I have set:
Mode->Executable
Exec+Param->"C:\Program Files\NUnit-Net-2.0 2.2.8\bin\nunit-console.exe" "XTests.dll"
List of assemblies to profile->XTests (so here should not be the dll name but the profiled assembly\namespace)
In Option tab :
Additional options->/noshadow /xml:"E:\UnitTests\XTests.dll.xml"

Thanks for your help!