
Code Coverage with TeamCity
January 25, 2008In my previous post on JetBrains TeamCity I mentioned that it has no support for .NET code coverage. With this post I want to correct the injustice of this statement. It was a simple case of RTFM that solved this issue. Actually this great post pushed me into the right direction (you can even download some specific TeamCity MsBuild tasks).
One might think you have to jump through quite some hoops in order to integrate code coverage, but it is actually really easy. Here goes:
1. Make sure that your build script creates a code coverage report. I'm using NCover/NCoverExplorer for this with the corresponding MsBuild tasks that you can download here (in the NCoverExplorer Extras package).
2. Add the code coverage results file to the artifacts:
3. Add the following line to the TeamCity Data Directory/config/ main-config.xml file as described here:
<report-tab title="CodeCoverage"
basePath=""
startPage="CodeCoverage.html"/>
4. You're done.
Now behold the results:
It creates a new tab for the build results that integrates the code coverage artifact. The coolness of TeamCity just keeps amazing me.
If you and your team want to learn more about how to write maintainable unit tests and get the most out of TDD practices, make sure to have look at our trainings and workshops or checkout the books section. Feel free to reach out at info. @ principal-it .be

Jan Van Ryswyck
Thank you for visiting my blog. I’m a professional software developer since Y2K. A blogger since Y2K+5. Provider of training and coaching in XP practices. Curator of the Awesome Talks list. Past organizer of the European Virtual ALT.NET meetings. Thinking and learning about all kinds of technologies since forever.
Comments


Writing Maintainable
Unit Tests
Watch The Videos
Latest articles
-
Tales Of TDD - The Case Of Overused Test Doubles
March 31, 2021
-
Book Launch: Writing Maintainable Unit Tests
February 17, 2021
-
Avoid Inheritance For Test Classes
January 6, 2021
-
How To Write Unit Tests For Logging
November 11, 2020
-
Prevent Domain Knowledge From Sneaking Into Solitary Tests
September 30, 2020
Tags
- .NET
- ALT.NET
- ASP.NET
- Agile
- Announcement
- Architecture
- Behavior-Driven Development
- C++
- CQRS
- Clojure
- CoffeeScript
- Community
- Concurrent Programming
- Conferences
- Continuous Integration
- Core Skills
- CouchDB
- Database
- Design Patterns
- Domain-Driven Design
- Event Sourcing
- F#
- Fluent Interfaces
- Functional Programming
- Hacking
- Humor
- Java
- JavaScript
- Linux
- Microsoft
- NHibernate
- NoSQL
- Node.js
- Object-Relational Mapping
- Open Source
- Reading
- Ruby
- Software Design
- SourceControl
- Test-Driven Development
- Tools
- Visual Studio
- Web
- Windows
Disclaimer
The opinions expressed on this blog are my own personal opinions. These do NOT represent anyone else’s view on the world in any way whatsoever.
About
Thank you for visiting my website. I’m a professional software developer since Y2K. A blogger since Y2K+5. Author of Writing Maintainable Unit Tests. Provider of training and coaching in XP practices. Curator of the Awesome Talks list. Thinking and learning about all kinds of technologies since forever.
Latest articles
Tales Of TDD - The Case Of Overused Test Doubles
Book Launch: Writing Maintainable Unit Tests
Avoid Inheritance For Test Classes
How To Write Unit Tests For Logging
Contact information
(+32) 496 38 00 82
info @ principal-it .be