TeamCity 5.0.1 + NCover 3.2 - what _should_ happen?

I've set up TeamCity 5.0.1 and I'm building my project using rake, which includes running ncover to generate code coverage data.

I'm then using a service message [1] to publish this file to TeamCity - I'm seeing this happen by looking in the logs. [2]

However - I don't see a code-coverage tab, or a chart on the statistics tab for my build-config in the same way that I do for fxcop or nunit, for example.

What _should_ happen?  The manual page describing this is listed as being in draft status, but the product has been released...?

[1]
##teamcity[importData type='dotNetCoverage' tool='ncover3' path='C:/BuildAgent/work/7cf06bbc131e6c5d/project/build/out/reports/ncover/Foo.Tests.coverage.xml']

[2]


[14:52:03]: [Execute out/reports/ncover/Foo.Tests.coverage.xml] Branch Coverage: 47.08%
[14:52:03]: [Execute out/reports/ncover/Foo.Tests.coverage.xml] Coverage Xml: C:\BuildAgent\work\7cf06bbc131e6c5d\project\build\out\reports\ncover\Foo.Tests.coverage.xml
[14:52:03]: [Execute out/reports/ncover/Foo.Tests.coverage.xml] ##teamcity[importData type='dotNetCoverage' tool='ncover3' path='C:/BuildAgent/work/7cf06bbc131e6c5d/project/build/out/reports/ncover/Foo.Tests.coverage.xml']
[14:52:03]: Invoke ncover_reports (7s)
[14:52:03]: [Invoke ncover_reports] ** Invoke ncover_reports (first_time)
[14:52:03]: [Invoke ncover_reports] ** Invoke ncover_profile
[14:52:03]: [Invoke ncover_reports] mkdir -p out/reports/ncover/Foo.Tests/
[14:52:03]: [Invoke ncover_reports] Importing data from 'C:/BuildAgent/work/7cf06bbc131e6c5d/project/build/out/reports/ncover/Foo.Tests.coverage.xml' with 'dotNetCoverage' processor
[14:52:03]: [Invoke ncover_reports] Execute ncover_reports (7s)
16 comments
Comment actions Permalink

I'm baffled by this problem as well. There are blog posts by various people suggesting how to *manually* get NCover reports setup using MSBuild, but I believe such advice was posted prior to TeamCity 5.0.

So I'd like an answer to this question as well. Now that we have an NCover option built into TeamCity, how do we get a coverage report tab to show up?

0
Comment actions Permalink

I've done a bit more digging and tried to set up custom charts for coverage myself, by adding:

     <graph title="NCoverage" seriesTitle="Coverage">
          <valueType key="CodeCoverageB" title="Block-level" buildTypeId="bt2" />
          <valueType key="CodeCoverageC" title="Class-level" buildTypeId="bt2" />
          <valueType key="CodeCoverageL" title="Line-level" buildTypeId="bt2" />
          <valueType key="CodeCoverageM" title="Method-level" buildTypeId="bt2" />
     </graph>

to the main-config.xml file and re-running the build.  A blank graph is displayed.

0
Comment actions Permalink

Could you please attach a screenshot of your build configutation settings and build agent logs.

Have you specified NCover paramters and enabled .NET Coverage in the build configuration settings?

0
Comment actions Permalink

I'm running nunit-console.exe from an executable in my source-control checkout, within the rake build-runner.  The command that gets executed is:


"C:/BuildAgent/work/7cf06bbc131e6c5d/3rdparty/nunit/bin/net-2.0/nunit-console.exe" "C:\BuildAgent\work\7cf06bbc131e6c5d\project\build\out\bin\Foo.Tests.dll" /xml="C:\BuildAgent\work\7cf06bbc131e6c5d\project\build\out\reports\nunit\Foo.Tests\Foo.Tests.nunit.xml"

I'm not using the built-in TeamCity NUnit Launcher because I wasn't able to find out how to supply the location of the executable to my rake build-script.  I thought it would be written into an environment variable.

I'm experimenting some more with that in parallel - but shouldn't the fact that I'm publishing (as far as I can tell successfully) the code-coverage files to TeamCity via service-message mean that the feature engages?

0
Comment actions Permalink

You may specify necessary environment variable as reference to the build system property. Please have a look to 'Properties and Environment variales' section of build configuration.

What build runner do you use?


Is that possible to move to MSBuild runner (with a proxy project)?
If you fill all parameters of the .NET coverage the service message will start working.

Pleaes note, TeamCity NUnit launcher will automatically call NCover to capture coverage data for your tests.

0
Comment actions Permalink

I use the rake build-runner.

What is wrong with the service-message I'm emitting?  Here's a copy-paste from the build-log


[Execute out/reports/ncover/Foo.Tests.coverage.xml] ##teamcity[importData type='dotNetCoverage' tool='ncover3' path='C:/BuildAgent/work/7cf06bbc131e6c5d/project/build/out/reports/ncover/Foo.Tests.coverage.xml']


I don't want to use the nunit-launcher because I don't want to run all of the tests all at once - I want to run first the unit-tests (which are fastest) then other, slower test suites.

I am, however, using the nunit-addin when running the test suites.  I noticed that there're a log entries to say it's watching a path, but didn't find anything.  Is that related?  Do the coverage report files have to get output to the same directory...?

[11:27:03]: NUnit report watcher
[11:27:03]: [NUnit report watcher] no files found
[11:27:03]: [NUnit report watcher] C:\BuildAgent\work\7cf06bbc131e6c5d\xml="C:\BuildAgent\work\7cf06bbc131e6c5d\project\build\out\reports\nunit\Foo.Tests\Foo.Tests.nunit.xml" couldn't find any matching files
0
Comment actions Permalink

Could you please attach a full build log.

What build runner do you use?
Have you enabled .NET coverage there?

Thanks!

0
Comment actions Permalink

Can I email you a log rather than post it to a public forum, please?

I use the rake build-runner.  There is no option within it to enable .NET code-coverage.

0
Comment actions Permalink

Please send it to teamcity-feedback (at) jetbrains.com

0
Comment actions Permalink

Hi Marina

I sent you as much as I could a few days ago, but have had no response or acknowledgement.  Please could you confirm whether or not you received it?

Cheers
Pete

0
Comment actions Permalink

Peter,

Sorry for delay in replying. We have received you you e-mail and will reply you as soon as possible.

0
Comment actions Permalink

Peter,

Sorry fow long delay.

TeamCity .NET Coverage support consists of 2 parts.

The first part is intergrated in the TeamCity NUnit runner (i.e. TeamCity.NUnit.Launcher.exe and <nunit2> task for NAnt and NUnitTeamCity task for MSBuild).
This part manages to start NCover process and make it gather coverage data from unit tests. Coverage results are sent to the server using the same service
message as you have used in you builds.

The second part of the support privides UI for configuring path to NUnit. If it was configured TeamCity NUnit test runner would have implicitly started NCover and
it whould have provided NCover log. Unfortunatly, this UI is only available for MSBuild, Sln2005 and Sln2008 build runner.

In cases you run gather coverage data without help of TeamCity you may use teamcity service message to publish coverage results. But, this message will only
work if NCover was enabled from the TeamCity UI. For your case it could be acceptable, but you will need to move to MSBuild build runner. You may start your
ruby build script from the MSBuild. This will make Coverage work.

Another approach is to copy run parameters from a build configuration with MSBuild and NCover to your ruby configuration. This way is not recommended, because
patched build configuration will not be editable from TeamCity web ui. Please let me know if you want to know more about this approach.


Another way to make NCover reporting in TeamCity from your rake script is to issue TeamCity statistics service messages as
described at
http://www.jetbrains.net/confluence/display/TCD5/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-ReportingBuildStatistics
To include generated NCover report to the build results as a tab see
http://www.jetbrains.net/confluence/display/TCD5/Report+Tabs

0
Comment actions Permalink

Hmmm, ok.  That's a shame.  I don't really want to switch build-runners, because before too long, I shall have cucumber examples happening, and if I switched, I would presumably have a similar problem the other way around.  I also don't really want to split up my builds into more than one config unless I _really_ can't avoid it.

I've filed a feature-request in your issue tracker asking for all report processors to be available from all build-runners (but, selfishly, at least ncover3 from rake ).

Just by the way, where can I find a screenshot of the code-coverage integration features in TeamCity?  I'd like to see what I'm missing, so I can make a trade-off decision.

0
Comment actions Permalink

It's easy to make NCover3 reporter work for rake build, but the main issue is to specify necessary NCover3 parameters.

NCover3 integration contains of the following:
- show coverage graphs
- show html report generated by NCover3 in the 'coverage' tab
- start NCover from TeamCity NUnit launcher.

0
Comment actions Permalink

Can you provide any screenshots, please?

0
Comment actions Permalink

The question perhaps no longer relevant. If it's not please leave а comment or create a separate thread.

Kind regards,
Marina

0

Please sign in to leave a comment.