Ludwo
Ludwo

Reputation: 6183

How to enable code coverage without using Visual Studio?

I have 80+ VS2010 solutions, each contains some unit test projects.
All solutions are merged into one big solution before build process.
All tests (or some test subset) are executed after the successful build.

I want to enable test code coverage for all tests to get exact code coverage for all output assemblies.

My question is: how to enable code coverage without using Visual Studio?

Note: I'm using TFS2010 (MSBuild) to build merged solution. VS 2010 Premium is installed on the build server. MSTest is used for test execution.

Upvotes: 2

Views: 3701

Answers (3)

James Reed
James Reed

Reputation: 14052

If you create a Vsmdi file in your large solution (ms test will usually do this for you) you can use this to tell the build which assemblies you want to instrument.

This will only provide code coverage for assemblies that have tests run against them. If you're using testrun.config files to decide which tests you want to run, this should be all you need. The code coverage results should then be published to the build drop location

Edit:

This blog post looks like it covers setting up code coverage

Upvotes: 2

pantelif
pantelif

Reputation: 8544

I think you need to consider deploying a code coverage tool, see here for a comparison (provided you implement .net).

We use NCover, which integrated in our TFS-Build in it's console variant and, although it's not trivial to set it up, we 're very satisfied with it.
In this post I had briefly described how we inserted NCoverin our build, this might we useful to you even if you go with another tool.

Upvotes: 2

Daniel Hilgarth
Daniel Hilgarth

Reputation: 174369

You can use JetBrain's TeamCity Professional. It is a CI server that supports executing unit tests and calculating code coverage. It is free for small installations.

Upvotes: 3

Related Questions