Bug with closing brace of block

Bug with closing brace of block

Sorry, I posted this in the suggestions/features forum but it should have been here: http://ncover.org/SITE/forums/thread/155.aspx



Re: Detailed list of NCover retur code

NCover returns the return code of the program that it is profiling.


Re: Detailed list of NCover retur code

I'm using NANT 0.85-rc3


Re: Problem with NCover and NUnit using XML settings file, empty

Hey Eric,

It needs Framework 2.0 (thought NCover must fail to even start up if it is missing). For the symbols problem, you will need to actually copy the pdb files to the NUnit directory where the dlls are present. You probably won't need the mscorlib symbols, unless you want that assembly profiled.

Something relevant --> http://community.sharpdevelop.net/blogs/mattward/archive/2006/01/31/CodeCoverageWithNCover.aspx

- Kamath

Ninjas hate pirates.
- Anonymous


Re: Problem with NCover and NUnit using XML settings file, empty

Using the "obj\Debug" directory instead of the "bin\Debug" directory has no effect.  I've reverted to NCover 1.3.3 with NUnit 2.2.8 and I have both .NET Frameworks 1.1 and 2.0 installed.  Instead of using an XML settings file I've tried running it from the command line with the following:

ncover.console /w "C:\Documents and Settings\ericrook\My Documents\Visual Studio 2003\Projects\GeneralLibTest\bin\Debug" /a Rook.General.Lib /c "nunit-console.exe" "Rook.General.Lib.Test.dll"

The resulting "Coverage.Xml" file still contains the empty <coverage> tag.  The following is the results of the "Coverage.Log" file:

EVENT:   Profiler Initialize
MESSAGE: Monitoring Assemblies: Rook.General.Lib;
MESSAGE: ------------------------------------------------------------------ Module: 0x79b66000
MESSAGE: Failed to load symbols for module [mscorlib.dll] in [c:\windows\microsoft.net\framework\v1.1.4322].
EVENT:   Loaded Module [c:\windows\microsoft.net\framework\v1.1.4322\mscorlib.dll]
MESSAGE: Module [0x79b66000] attached To assembly [0x00152570]
EVENT:   Loaded Assembly [mscorlib][0x00152570]
MESSAGE: ------------------------------------------------------------------ Module: 0x00172978
MESSAGE: Failed to load symbols for module [nunit-console.exe] in [C:\Program Files\NUnit 2.2.8\bin].
EVENT:   Loaded Module [C:\Program Files\NUnit 2.2.8\bin\nunit-console.exe]
MESSAGE: Module [0x00172978] attached To assembly [0x00172748]
EVENT:   Loaded Assembly [nunit-console][0x00172748]
MESSAGE: ------------------------------------------------------------------ Module: 0x00176540
MESSAGE: Failed to load symbols for module [nunit-console-runner.dll] in [c:\program files\nunit 2.2.8\bin].
EVENT:   Loaded Module [c:\program files\nunit 2.2.8\bin\nunit-console-runner.dll]
MESSAGE: Module [0x00176540] attached To assembly [0x00176378]
EVENT:   Loaded Assembly [nunit-console-runner][0x00176378]
MESSAGE: ------------------------------------------------------------------ Module: 0x001845a0
MESSAGE: Failed to load symbols for module [nunit.util.dll] in [c:\program files\nunit 2.2.8\bin].
EVENT:   Loaded Module [c:\program files\nunit 2.2.8\bin\nunit.util.dll]
MESSAGE: Module [0x001845a0] attached To assembly [0x00184400]
EVENT:   Loaded Assembly [nunit.util][0x00184400]
MESSAGE: ------------------------------------------------------------------ Module: 0x7beb6000
MESSAGE: Failed to load symbols for module [system.xml.dll] in [c:\windows\assembly\gac\system.xml\1.0.5000.0b77a5c561934e089].
EVENT:   Loaded Module [c:\windows\assembly\gac\system.xml\1.0.5000.0
b77a5c561934e089\system.xml.dll]
MESSAGE: Module [0x7beb6000] attached To assembly [0x00186e38]
EVENT:   Loaded Assembly [System.Xml][0x00186e38]
MESSAGE: ------------------------------------------------------------------ Module: 0x0018abd0
MESSAGE: Failed to load symbols for module [nunit.core.dll] in [c:\documents and settings\ericrook\local settings\application data\assembly\dl2\zz96qldy.t68\dtgadckk.6hr\91e89fee\0035d91c_3366c601].
EVENT:   Loaded Module [c:\documents and settings\ericrook\local settings\application data\assembly\dl2\zz96qldy.t68\dtgadckk.6hr\91e89fee\0035d91c_3366c601\nunit.core.dll]
MESSAGE: Module [0x0018abd0] attached To assembly [0x001893a0]
EVENT:   Loaded Assembly [nunit.core][0x001893a0]
EVENT:   Profiler Shutdown

Any ideas?


Re: Problem with NCover and NUnit using XML settings file, empty

I have figured out the problem and it is an error on my part.  The General.Lib.Test.dll contains tests for the General.Lib.dll.  However, I took the time to write a test fixture for each static function in the General.Lib, but I have never added anything else.  All the test fixtures are there, just empty.  So the functions of the General.Lib are never called.  This is the reason the resulting "Coverage.xml" had an empty tag.  Once I added some function calls from the General.Lib it the "Coverage.xml" file was no longer empty.  Thanks for the help Kamath.  Sorry about that everyone.


Re: Problem with NCover and NUnit using XML settings file, empty

With NCover 1.3.3, NUnit 2.1.4 and .Net Framework 1.1, I still received "Failed to load symbols..." messages in the Coverage.log even though I have pdb files available in the NUnit folder for all complained nunit*. Here are the missing symbols specified in the log file between the Profiler Inistialize and Shutdown:

EVENT:   Profiler Initialize
MESSAGE: Monitoring Assemblies:
MESSAGE: Failed to load symbols for module [mscorlib.dll] in [c:\windows\microsoft.net\framework\v1.1.4322].
MESSAGE: Failed to load symbols for module [nunit-console.exe] in [d:\NUnit\bin].
MESSAGE: Failed to load symbols for module [nunit.util.dll] in [d:\nunit\bin].
MESSAGE: Failed to load symbols for module [nunit.framework.dll] in [d:\nunit\bin].
MESSAGE: Failed to load symbols for module [system.xml.dll] in [c:\windows\assembly\gac\system.xml\1.0.5000.0__b77a5c561934e089].
EVENT:   Loaded Module [c:\windows\assembly\gac\system.xml\1.0.5000.0__b77a5c561934e089\system.xml.dll]
MESSAGE: ---------------------EVENT:   Profiler Shutdown

Since the Profiler has shut down (according to the log file), the Coverage.xml has nothing reported other than a big word "Code Coverage Report".

I really need help to get through it. Big thanks in advance.

- Erica


Re: Problem with NCover and NUnit using XML settings file, empty

Erica,

The "Failed to load symbols" messages for nunit .dlls and mscorlib.dll are of no consequence and "normal" operation of NCover. My understanding is that they just indicate that the named .dll does not have an associated .pdb where that .dll was found and hence NCover will not profile it. That's a good thing - we don't want NUnit execution coverage merged into your actual application test coverage (the one exception being if you were an NUnit developer of course).

So... the only "Failed to load symbols" messages you should care about are for your own application assemblies. The common mistakes I've seen people make with these are:

- having a version of their .dll in the GAC
- not having the pdbs in the right folder
- not having code actually invoking the methods they want to see coverage on (so the assembly is not even loaded)
- not having coverlib.dll COM registered

What are you actually trying to achieve - unit test your own code or make enhancements to NUnit? If the first (which is what 99.9% of people are trying to do) then ignore trying to put things in the NUnit folder.

Just post your command line and we can take a look. My best guess is that you have something wrong with that which is causing your unit tests not to execute, hence your application code is not being loaded and why none of your application assemblies are appearing in coverage.log.


Re: Problem with NCover and NUnit using XML settings file, empty

I am having a similar problem as what’s being described above.  However, I am a noob.  I don't use NAnt (yet), I just wrote my first NUnit tests yesterday.  I was successful in writing my test, running NUnit, getting errors and fixing them.

As far as NCover is concerned, I want to see which lines of code aren't tested.  (I haven't started using TDD yet since I am still learning it's concepts.)  I have downloaded NCover as well as NCoverExplorer.  I have not been able to find any documentation on how to get things set up, BUT NCoverExplorers File>Run NCover seems simple enough.

When I run that little app, I get one of two things to happen.  This shows up on the right:

NCover.Console v1.5.5 - Code Coverage Analysis for .NET - http://ncover.org
Copyright (c) 2004-2005 Peter Waldschmidt

Command: C:\Program Files\NUnit-Net-2.0 2.2.8\bin\nunit-gui.exe
Command Args:
Working Directory: C:\test\bin
Assemblies:
Coverage Xml: coverage.xml
Coverage Log: coverage.log
Waiting for profiled application to connect...Connected
Configuring Profiler...
******************* Program Output *******************

NUnit opens, but does not run.  If I click run, my tests run successfully.  Then I close NUnit's GUI and I see the Coverage file in NUnitExpolrer

If I use NUnits councle.exe, I get the same end results, but there is no popup or showing of NUnit.

I'm sure I'm doing something wrong, but I have been unable to find help anywhere else.  Could someone help me out or point me in the right direction?


Re: Problem with NCover and NUnit using XML settings file, empty

A couple of problems here that can be seen from the output:

(1) If you are profiling NUnit with NCover, you want to be running nunit-console.exe, not nunit-gui.exe. You don't want a "popup" as such.

(2) You will need to supply the name of the .dll containing your unit tests as a command argument to NUnit. See how "Command Args:" is empty above? You want that listing your dll.


Re: Problem with NCover and NUnit using XML settings file, empty

Thanks, that helped a bunch.  Now my output it the following:

Command: C:\Program Files\NUnit-Net-2.0 2.2.8\bin\nunit-console.exe
Command Args: App_Code.dll
Working Directory: C:\test\bin
Assemblies:
Coverage Xml: coverage.xml
Coverage Log: coverage.log

With that I get a much longer coverage.log file as well as a new file I never got before: TestResult.xml  Unfortunatly, coverage.xml is still just <coverage />.

Any other hints?  What other information might be helpful to you?


Re: Problem with NCover and NUnit using XML settings file, empty

1. Does the .pdb for that .dll exist in the working directory?

2. Have you COM registered CoverLib.dll (done by default as part of the NCover installation)?

3. What version of NCover are you using?

4. As you mentioned using NCoverExplorer to run NCover, can you click on the "Command Line" button option and paste that back here to take a look at your parameters.

 


Re: Problem with NCover and NUnit using XML settings file, empty

Hummmm...

1. I'm not sure what a .pdb file is, nor how to generate it.  There is no .pdb files in my c:\test\bin dir.

2. I haven't explicitly done anything to register it.  Although, the option to "Register CoverLib.dll before running NCover" in NCover Runner is checked.

3. NCover 1.5.5 and NCoverExplorer 1.3.5.1872

4. Copy and paste from NCover Runner:

"C:\Program Files\NCover\NCover.Console.exe" //w "C:\test\bin" "C:\Program Files\NUnit-Net-2.0 2.2.8\bin\nunit-console.exe" App_Code.dll

I really appreciate your help!


Re: Problem with NCover and NUnit using XML settings file, empty

PS - Perhaps you should know that I am trying to test an ASP.NET dll.  I have about 7 classes (VB.NET), 1 test class in the App_Code dir.  I compile it with the following command:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler.exe -p . -v / c:\test -u

Maybe this is a reason for my issue?


Re: Problem with NCover and NUnit using XML settings file, empty

Without the .pdb files you will get no coverage as NCover needs these to produce it's output. A .pdb file is the debugging symbols file which is used to reconcile between a line in the source code and the compiled instructions.

http://dotnetjunkies.com/WebLog/nandagopalweblog/archive/2005/09/07/132399.aspx

Add a -d switch to your commandline for the compiler, hopefully this will generate the necessary files. I don't develop in ASP.Net myself (and when I last did I was using the IDE) so I'm winging it a bit...


Re: Problem with NCover and NUnit using XML settings file, empty

Good to know that some symbols are not required even though they are complained in the log file. What about this:

MESSAGE: Failed to load symbols for module [system.xml.dll] in [c:\windows\assembly\gac\system.xml\1.0.5000.0__b77a5c561934e089].
EVENT:   Loaded Module [c:\windows\assembly\gac\system.xml\1.0.5000.0__b77a5c561934e089\sEVENT:   Profiler Shutdown

Note that Profiler shut down with the missing symbol of system.xml.dll. I don't even have the \gac folder on my local. What system.xml.dll is that?

For the common mistakes you mentioned, I believe I did it right as I see the unit tests assemblies loaded successfully in the log. However I see two Profiler Shutdown in the log and as a result the Coverage.xml still only displays "Code Coverage Report" with no details.

Here is my command line:

ncover.console /c D:\NUnit\nunit-console UnitTests.dll /w "D:\working" /l "C:\Program Files\NCover\Coverage.log" /o "C:\Program Files\NCover\Coverage.xml"

And received the following in the command prompt:

******************* 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.0    .NET Version: 1.1.4322.2032..........
Tests run: 10, Failures: 0, Not run: 0, Time: 30.171 seconds
***************** End Program Output *****************

Many Thanks,

Erica


Re: Problem with NCover and NUnit using XML settings file, empty

Hi Erica,

I can't see anything obviously wrong there - I take it you are testing a .Net 1.0 or 1.1 application (since your NCover version is 1.3.3)?

I'm thinking about knocking up a little "NCover test suite" zip file with sample command lines etc that people can download and run then pull apart to find out what is so different about their app. I might write some blog entry tutorials to go with it stepping through the common issues etc. Perhaps that may be of some use?

There is always the possibility that you have hit one of the quirky cases where NCover trips over. NCover 1.3.3 does have a few problems (as do the later versions too to be brutally honest). Best to work through the basics first though as for simple cases at least it usually works ok.


Re: Problem with NCover and NUnit using XML settings file, empty

Thanks Greg - the "-d" did the trick.  This has been a lesson for me to really get to know the compiler arguments and what they do.  Next stop - Learn NAnt so my code will be compiled, tested, checked for coverage etc etc all in one click!


Re: Problem with NCover and NUnit using XML settings file, empty

On behalf of "Greg", glad to hear you got it working ;-)

If you havent already you might also want to look at http://testdriven.net/- it will do the compile/test/check for coverage all in one click too (but within the VS.Net IDE, not for use on a build server). Much nicer than running the command line!

If you are looking to automate your build (for instance to use it with CruiseControl.Net then either NAnt or MSBuild is the way to go. You might also find it useful to use the NCover NAnt and/or MSBuild tasks I wrote - depending on what you are doing it can save you from "command line hell" with the <exec> task.

Then (of course) I recommend you incorporate NCoverExplorer into your build as well - both to interrogate the coverage results interactively as well as automating the generation of coverge reports.

You can find all the NCover/NCoverExplorer related tasks and documentation linked on my blog. Good luck...


Re: Problem with NCover and NUnit using XML settings file, empty

Hi,

The heading for this thread matches my issues exactly.
While new to NCover I have been using NUnit for some time. I am using VS2005 with .Net 2.0,  Nunit  2.2.8 and NCover 1.5.5.
My setting file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<ProfilerSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">;
  <CommandLineExe>C:\Program Files\NUnit-Net-2.0 2.2.8\bin\nunit-console.exe</CommandLineExe>
  <CommandLineArgs>"C:\Application\Source\ABC\UnitTests\bin\ABC.UnitTests.dll"</CommandLineArgs>
  <Assemblies>C:\Application\Source\ABC\UnitTests\bin\ABC.dll</Assemblies>
  <LogFile>C:\coverage.log</LogFile>
  <CoverageXml>C:\coverage.Xml</CoverageXml>
  <WorkingDirectory>C:\Application\Source\ABC\UnitTests\bin</WorkingDirectory>
  <VerboseLog>false</VerboseLog>
  <ProfileIIS>false</ProfileIIS>
  <DumpOnErrorNormal>false</DumpOnErrorNormal>
  <DumpOnErrorFull>false</DumpOnErrorFull>
  <NoLog>false</NoLog>
 </ProfilerSettings>

I then execute the command from the bin directory:

"C:\Program Files\NCover\NCover.Console.exe" //r ..\NCoverSettings.xml

 I see the tests run but the coverage.xml file only contains:

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="coverage.xsl" type="text/xsl"?>
<!-- saved from url=(0022)http://www.ncover.org/ -->
<coverage />

Any ideas why this is happening?

-Adam


Re: Problem with NCover and NUnit using XML settings file, empty

The problem is the <Assemblies> section - it should just be the assembly name without a path or .dll suffix.
i.e. <Assemblies>ABC</Assemblies>


Re: Problem with NCover and NUnit using XML settings file, empty

I'm getting a similar problem in that Ncover seems to run ok but i'm getting no coverage report. I'm  running ncover from Nant and i'm using  the 1.1 .net framework and ncover version 1.3.3 and nunit 2.2.8.

 i've tried two different nant  task to try and produce a report  but to no avail.

 these are

<ncover program="tools\NCover\NCover.Console.exe"

commandLineExe="tools\NUnit\bin\nunit-console.exe"

commandLineArgs="ClearspanAdapters.Test.dll"

workingDirectory="build\"

assemblyList="ClearspanAdapters"

coverageFile="coverage.xml"

logLevel="Normal" />

 

And

<ncover program="tools\ncover\Ncover.Console.exe" commandLineExe="tools\nunit\bin\nunit-console.exe" commandLineArgs="ClearspanAdapters.Test.dll /xml=${project::get-name()}2.Test-Results.xml" workingDirectory="build\" logLevel="Verbose" verbose="true" coverageFile="build\coverage.xml">

<assemblies basedir="build\">

<include name="Assessors.dll"/>

<include name="${project::get-name()}"/>

</assemblies>

</ncover>

My results from running the nant script are as follows for the ncover section

ncover:

   [ncover] Creating settings file: C:\Documents and Settings\itballd1\Local Set
tings\Temp\tmpCA.tmp.ncoversettings
   [ncover] Working directory: C:\Working Directory\C# Projects\trunk\ClearspanA
dapters
   [ncover] Arguments: /r "C:\Documents and Settings\itballd1\Local Settings\Tem
p\tmpCA.tmp.ncoversettings"
   [ncover] <?xml version="1.0" encoding="utf-8"?>
   [ncover] <ProfilerSettings>
   [ncover]   <CommandLineExe>tools\nunit\bin\nunit-console.exe</CommandLineExe>

   [ncover]   <CommandLineArgs>ClearspanAdapters.Test.dll /xml=ClearspanAdapters
2.Test-Results.xml</CommandLineArgs>
   [ncover]   <WorkingDirectory>build\</WorkingDirectory>
   [ncover]   <Assemblies>Assessors</Assemblies>
   [ncover]   <CoverageFile>build\coverage.xml</CoverageFile>
   [ncover]   <LogFile>coverage.log</LogFile>
   [ncover]   <VerboseLog>true</VerboseLog>
   [ncover]   <NoLog>false</NoLog>
   [ncover]   <NoXslCopy>true</NoXslCopy>
   [ncover] </ProfilerSettings>
   [ncover] Starting 'tools\ncover\Ncover.Console.exe (/r "C:\Documents and Sett
ings\itballd1\Local Settings\Temp\tmpCA.tmp.ncoversettings" )' in 'C:\Working Di
rectory\C# Projects\trunk\ClearspanAdapters'
   [ncover] NCover.Console v1.3.3 - Code Coverage Analysis for .NET - http://nco
ver.org
   [ncover] Command: tools\nunit\bin\nunit-console.exe
   [ncover] Command Args: ClearspanAdapters.Test.dll /xml=ClearspanAdapters2.Tes
t-Results.xml
   [ncover] Working Directory: build\
   [ncover] Assemblies: Assessors
   [ncover] Coverage File: build\coverage.xml
   [ncover] Coverage Log: coverage.log
   [ncover] ******************* Program Output *******************
   [ncover] NUnit version 2.2.8
   [ncover] Copyright (C) 2002-2003 James W. Newkirk, Michael C. Two, Alexei A.
Vorontsov, Charlie Poole.
   [ncover] Copyright (C) 2000-2003 Philip Craig.
   [ncover] All Rights Reserved.
   [ncover] OS Version: Microsoft Windows NT 5.1.2600.0    .NET Version: 1.1.432
2.2032
   [ncover] ..00:00:00.0156250
   [ncover] ...00:00:00
   [ncover] .00:00:00.0156250
   [ncover] ...00:00:00
   [ncover] .00:00:00
   [ncover] ...00:00:00
   [ncover] Tests run: 13, Failures: 0, Not run: 0, Time: 0.156 seconds
   [ncover] ***************** End Program Output *****************
   [ncover] Deleting settings file: C:\Documents and Settings\itballd1\Local Set
tings\Temp\tmpCA.tmp.ncoversettings

 

 but as i  have said no report

 

 

 


Re: Problem with NCover and NUnit using XML settings file, empty

davethehat,

I had the same problem with NCover 1.3.3. You will need NCover 1.5.4. Install .Net 2.0 so that version 1.5.4 can be installed. I have a beautiful report generated with 1.5.4.

Hope that helps.

Erica


Re: Problem with NCover and NUnit using XML settings file, empty

Hi Dave,

What version of the NCoverExplorer.NAntTasks.dll are you using?

Thanks for the detailed output - it really helps with diagnosing! One thing I spotted with your second NAnt task is the way you have done your <assemblies> list. You are missing a .dll suffix on the second <include>. When you use the assemblyList attribute it is correct to not have the .dll suffix as this is passed straight through  to NCover. However when using the <assemblies> fileset approach the file pattern match will require it - the NCover NAnt task will automatically strip off the .dll suffix for passing to NCover.

<include name="${project::get-name()}.dll"/> 

You can see the effect of that in the verbose NAnt output that it is only listing one assembly for reporting profiled results on:

  [ncover]   <Assemblies>Assessors</Assemblies>

So NCover will only be including in the report profiled information from the Assessors.dll. The reasons why you may still not get any output:

(1) Is the Assessors assembly being loaded by your unit tests at all? Or are they only calling code in other assemblies? NCover will only profile the asemblies that get loaded into memory.

(2) Has an Assessors.pdb file been generated and existing in the build folder?

I would suggest you try removing the assemblyList attribute / <assemblies> section to start with and make sure you get an output coverage.xml - not specifying an assembly list will just profile all assemblies loaded with .pdbs. Once you have that working then you can start applying a filtering mechanism of the assembly list to reduce down the coverage xml.