News

Laurent Kempé MVP

Contact

My status

View Laurent Kempé's profile on LinkedIn
XING


Xbox 360



Map

Locations of visitors to this page

.NET Dudes

Family

French .NET Dudes

Friends

Links

Tech Head Brothers

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

Elizaveta Revyakina said:

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

# March 31, 2008 10:02 AM

lkempe said:

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

# March 31, 2008 10:15 AM

Håkan Reis said:

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.

# April 4, 2008 4:10 AM

pkellner said:

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

# April 5, 2008 8:25 AM

Chris Walquist said:

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 <NCover>, then <NCoverExplorer> 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 <NCoverExplorer> 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

# April 29, 2008 2:59 PM

Laurent Kempé said:

After one comment of Chris Walquist on one of my last post about Team City integration of NCover here

# April 29, 2008 4:05 PM

lkempe said:

Chris: Thanks for the feedback about the article!

See my last post (weblogs.asp.net/.../run-ncover-through-msbuild-in-team-city.aspx) that reply to you questions!

# April 29, 2008 4:06 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)