.NET coverage plugins


Is there any way to extend TeamCity 5 .NET coverage tasks? I.e. add support to another coverage tool or integrate existing (partcover).
And as a part of this question - as far as I understood TeamCity API is java API, however at least some .net plugins are present on the agent as .net libraries - is there any .NET api for plugin development?

Best Regards,

Comment actions Permalink

We have no dedicated .NET api for TeamCity.
Starting from 5.0 it supports .NET coverage tools does this support matches?

TeamCity contains some .NET assemblies to support NUnit,NAnt, MSBuild, MSTest and other tools.
TeamCity NUnit test runner is able to start coverage process implicitly.

Could you please elaborate you goal.

Comment actions Permalink

My goal is to make teamcity support other .NET coverage tools - not necessarily profiler-based. Optionally it could be possible to integrate coverage tool inside plugin - it could simplify configuration of build server and project. The reason behind this is that only commercial version of NCover supports x64 platform.
I.e. we have a project that uses x64 version of SQLite for unittests (all our servers and workstations are x64), but at the same time in order to build coverage it is necessary to create separate x32 build configuration and manually modify project file to have conditional reference to a x86 SQLite dll which does not seem to be correct solution - VS does not understand such references.

As for "other" coverage tools - for me there are at least 2 possibilities - NCover (http://ncover.sourceforge.net/) or my own coverage tool (http://www.codeproject.com/KB/cs/dot-net-coverage.aspx) + NCoverExplorer. Maybe it's not too hard make Partcover support x64, but I lack experience even to estimate amount of work to do it.

Comment actions Permalink

TeamCity implementation of .NET coverage constains the following steps:
- TeamCity NUnit runner is able to start Coverage process with right arguments.
- TeamCity build agent processes created coverage report xml files to publish statistic values
- TeamCity web UI shows coverage statististic graphs.

All those things are not so complicated to implement in the build script.
Please note, TeamCity NUnit runner mays fork several processes under to start the tests.

How do you run NUnit tests? Do you use NUnit?

Please have a look at
to find information on how to add custom statistics reporting from the build script.

This page
describes how to attach custom graph for statistic values.

Comment actions Permalink

The point is that we are using VS2008 build runner and I don't know any way to alter it's build process. Another point - we are using TeamCity only as a CI server for development. Deployment and publishing process was already setup and debugged before - using TFS, so moving to MSbuild or NAnt is not an option. At the same time I don't know any way of adding optional/custom steps to the build process in TeamCity - like "executable" task in CC.NET.

Moreover, changing build scripts for the sake of code coverage does not seem right thing.

As for unittesting - yes currently we are using NUnit but some of our projects have MSTest unittests - and the only way of running coverage for them that I've found was to execute them with "NUnit 2.2.9 VSTS and MSTest (deprecated)" runner - MSTest didn't worked for me with coverage.

While writing all this a thought stroke me that it should be possible to trick NCover/PartCover coverage runner to run another executable file - which would be a proxy to different coverage tool - probably I'll give it a try.

Comment actions Permalink

What TeamCity supports is running .NET coverage for NUnit. Actually I think it is possible to start MSTest.exe from a code coverage tool. Feel free to post the issue to TeamCity issue tracker at http://youtrack.jetbrains.net to support .NET code coverage for MSTest.

Please note, TeamCity NUnit test runner cares about right .NET Framework version (1.1, 2.0 or 4.0) and about runtime (x86, x64).
If you would try running partcover compiled for x64 with the test runner it may continue running unit tests under x86 or wise versa.
I believe you may give it a try.

Deprecated MSTest and NUnit runner is highly unrecommended way of running tests, because it may not behave in the same way as MSTest does.

I would recommend you to write a small MSBuild/NAnt script to run all your unit tests inside it.

I have just removed deprecated NUnit and MSTest tests runner in TeamCity 5.1 thinking that supporting MSTest would be enough.


Please sign in to leave a comment.