Is anyone using dotCover with Continuous Integration (not TeamCity)?

We use Jenkins/Hudson as our Continuous Integration server and we are currently evaluating dotCover and NCover.  From what I've been reading on blogs and elsewhere, it seems like NCover is better for CI builds as it does not require Visual Studio.  Is this still true?  I want our builds to fail if coverage is not up to par.

Is there an up-to-date web page that compares and contrasts dotCover and NCover?  I'd really like to use dotCover because I am a huge fan of ReSharper and I really like the Visual Studio integration, but if we can't make threshold checking a part of the CI process, dotCover doesn't cut the mustard for us.

5 comments

Hello Jack

dotCover comes with a console runner that doesn't require Visual Studio and that can automatically produce coverage report during a CI build. You can start with http://blogs.jetbrains.com/dotnet/2010/07/running-code-coverage-from-the-console-with-dotcover/. Thank you!

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with  pleasure!"

0

Thanks for your help.  It took me a while to configure dotCover to use MSTest.exe because your examples only show how to use MSpec.exe.

But now that I have the command line working, I still don't know how to fail a build if coverage does not hit a certain threshold.  How would I do that?

0

Hello Jack

If you're using TeamCity, there's a built-in feature: http://blogs.jetbrains.com/teamcity/2011/08/22/fail-build-on-metric-change-in-teamcity-7-0/. If not, you can parse the coverage xml report file and check the total coverage percentage. Thank you!

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with  pleasure!"

0

Thanks, Andrey.

I was able to implement this using MSBuild and MSBuild Community Tasks

Here's the build target that I used to enforce 90% coverage:

 <Target Name="DetermineCoverage">
 <Message Text="==================================================" />
 <Message Text="Determine Unit Test Coverage" />

 <XmlRead
 XPath="/Root/@CoveragePercent"
 XmlFileName="dotCoverOutput.xml">
 <Output TaskParameter="Value" PropertyName="CoveragePercent"/>
 </XmlRead>
 <Message Text="==" />
 <Message Text="== Coverage Percentage $(CoveragePercent)" />

        <Error
            Text="Unit Test coverage did not exceed the desired threshold"
            Condition="$(CoveragePercent) &lt; 90" />

 <Message Text="==================================================" />
 </Target>


You need MSBuild Community Tasks to call XmlRead.
0

We're using dotCover with CruiseControl.NET.  Let me know if you have any questions.

0

Please sign in to leave a comment.