Mar
30
2008

Integration of NCover into Team City for Tech Head Brothers

Starting the development of the new Tech Head Brothers in a remote multi developers environment I wanted to have some tooling to ease our work. For sure we have:

  1. A code repository: Subversion installed using VisualSVN server
  2. A continuous integration server: Team City

The continuous integration MSBuild script is doing the following steps:

  1. Compiling the code checked out by Team City
  2. Run NUnit tests
  3. Run NCover code coverage, that's the new integration of today
  4. Precompile the website
  5. Package the website
  6. Deploy the website on IIS in a staging stage

In Team City I have two configuration settings for the Portal project:

  1. CI - Trunk - Unit Tests - Coverage - Deploy Staging: Run as Continuous integration with unit test, code coverage and deployment to iis
  2. Daily - Trunk - Duplicate Finder: Run daily and find duplicates in our code

Now for each build I can look at those information!

I can see that all my 35 tests passed, the changes made, the log of the build, Artifacts that I defined (more in a minute) and finally a new tab Code Coverage Summary.

The unit tests are ok for a start but needs some more work as we can see! But ins't that cool to get the output directly in Team City! I love it.

And finally the artifacts tab

On this tab I get the output that is shown on the tab Code Coverage Summary as a file that I can download; CoverageSummary.html generated by MSBuild script using NCover, I also get the folder Coverage on which I can click on the index.html file to get a full report of NCover as you can see:

 

To get access to those Artifacts I needed to define in my settings the following:

And also modify the Team City server main-config.xml as described here with the following entries:

<report-tab title="Code Coverage Summary" basePath="" startPage="CoverageSummary.html" />
<report-tab title="Code Coverage" basePath="/Coverage/" />

To integrate NCover into my Continuous Build process made with MSBuild script I used the documentation on that page.

Update: First take care that in the main-config there are already some report-tab configuration, and the name msut be unique. If the name is not unique then the first in the list will be taken. So I removed the predefined report-tab and modified the one from my last post to this:

<report-tab title="Code Coverage Summary" basePath="" startPage="CoverageSummary.html" />
<report-tab title="Code Coverage" basePath="Coverage" startPage="index.html" />

Comments (13) -


Hello Laurent,


Thank you very much for your comprehensive description of TeamCity extensibility. I will reference it in TeamCity official blog if you don't mind.

Regards,
Elizaveta

Elizaveta: Thanks! Yeah you can reference it for sure!

I have been struggling with this for a few days now. There are several problems to overcome.

It would be interesting to se the targets in your msbuild project. And a bit more explained on the artefacts part. I try to use NCover 1.5.8 and finally got it to run. Now on to NCoverExplorer, but that another story.

how did nunit integration go for you?  I'm hoping to have integration with web test in vs2008.  Any thoughts on that?

Peter Kellner
MVP, ASP.NET

http://

Hi Laurent,

Great article, and very timely!

I tried this with NCover 2.0.4 eval, on TC 3.0.  I got the artifacts to show up, and the "Code Coverage" tab.

My mileage varied slightly in some respects; I too would like to know more about how you invoked NCover.  I used an MSBuild runner invoking , then tasks following the build itself.

Wondering specifically...

1) How did you get your "tests" tab to show up as well?  Did you have to run the tests with NUnitLauncher, and then run again for coverage?  I read that NUnitLauncher can't be used to profile, since it kicks off a separate process.

2) How did you get the "classes", "header", "index", etc. files?  I just get the summary.html.  I see options for this in ncover.console.exe but not in the target.

3) Did you use wildcard expressions to pass a list of test assemblies to NCover?  If so, would like to see how you did that, too.

Thanks!
-chris

Chris: Thanks for the feedback about the article!
See my last post (weblogs.asp.net/.../...h-msbuild-in-team-city.aspx) that reply to you questions!

http://

Laurent, thanks for the add'l writeup, I reference it often!  For those using ncoverexplorer NAnt tasks, a couple of report types are missing from the NAnt doc section, in particular the "FullCoverageReport" which generates the output that Laurent screenshot'd above.  The full list seems to be here: www.ncover.com/.../reporting#report.  So just plug in reportType="FullCoverageReport", and you're good to go.

-chris

Chris: You might also see how I do it in my MSBuild in the following post: weblogs.asp.net/.../...h-msbuild-in-team-city.aspx

http://

Reading this and the article on NDepend and NCover.

Are these targets project based or are they solution based? How would this work with solutions?

I have a solution containing multiple projects. In team city I have setup a 2008sln build runner but now i don't know where to put the targets you specify above?

Joe: It is solution based, I added a web deployment project to the solution that I modified and used with different build configurations.

Before implementing NCover in our NAnt build script TC tracked our NUnit test results in the TEST_INFO table and the TC web interface displayed at Tests tab to view the results.

We have now implemented NCover in our NAnt script, meaning the NUnit tests are run via NCover within TC. Now TC is no longer tracking our NUnit test results in TEST_INFO table and the Tests tab no longer appears in the TC web interface.

I've read several blogs concerning NCover, NUnit and TC integration with no mention of this issue. I noticed this blog has a screen shot showing the Test Tab and Code Coverage tab, so it appears to work.

Have you heard or seen this issue? I did not see anything mentioned in forum. Any suggestions?

I did create a forum post here.
www.intellij.net/.../thread.jspa

Hi Laurent,

I know it's in excess of 6 months since you wrote this post but I wonder if you would consider attempting to answer the following:

One of the dev teams here has just started out using TeamCity and would appear based on your post to have a similar set up.

They develop in a branch which they take at the beginning of every iteration with the intention of keeping the trunk stable.

I've suggested to them the following build configurations:

Branch - Build & Unit Test (Triggered on VCS commit)
Branch - Deploy To System Test (Triggered Manually)
Branch - Deploy To UAT (Triggered Manually)
Trunk - Deploy To System Test (Triggered Manually)
Trunk - Deploy To UAT (Triggered Manually)
Trunk - Deploy To Live (Triggered Manually)

If you have time, could you suggest how you would approach knowing which build revision number to build in say "Branch - Deploy To System Test" given that the tester wouldn't always necessarily want the most recent build. One thing that I have thought of suggesting we use in a build dependency based on the last pinned build, I'd be open to suggestions if you think there is a more appropriate way of achieving this though.

I've asked this question on the TeamCity forums (www.jetbrains.net/devnet/message/5227684#5227684) in full if you would prefer responding there, alternatively you can reach me at dan dot rough at 7digital dot com. Obviously any help from yourself in this matter would be really appreciated.

Thanks, Dan.

Now humen have an opportunity to utilize the http://www.primethesis.com">thesis writing services that can compose supreme thesis topics close to this topic. But we propose to determine the famous http://www.primethesis.com">buy dissertation service to buy dissertation online in.                              

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

About Laurent

Laurent Kempé

Laurent Kempé is the editor, founder, and primary contributor of Tech Head Brothers, a French portal about Microsoft .NET technologies.

He is currently employed by Innoveo Solutions since 10/2007 as a Senior Solution Architect and certified Scrum Master.

Founder, owner and Managing Partner of Jobping, which provides a unique and efficient platform for connecting Microsoft skilled job seekers with employers using Microsoft technologies.

Laurent is awarded by Microsoft since Avril 2002: Most Valuable Professional (MVP).

MVP
Certified ScrumMaster
JetBrains Academy Member

My status

Twitter

Flickr

www.flickr.com
This is a Flickr badge showing public photos and videos from Laurent Kempé. Make your own badge here.

Month List

Page List