Home OpenCover Addin for SharpDevelop
Post
Cancel

OpenCover Addin for SharpDevelop

Last weekend I was bit of busy. This time I found it too boring to work with PartCover and suffer its well known x64 unfriendliness. I was looking for a long term solution and could not help hacking SharpDevelop to meet my needs. That led to the birth of OpenCover addin for SharpDevelop.

This post is going to document some history about SharpDevelop’s unit test coverage tool integration. So if you are just interesting in the addin itself, please scroll to the bottom of this post and grab the code.

SharpDevelop with NCover

SharpDevelop has been a test driven development IDE for years and personally I think this is one of its design goals. But its code coverage support just started in 2006 [1].

At that time, NCover (authored by Peter Waldschmidt) seems to be the only feasible solution, and its was free[2]. But the turn to closed source development [3] of course made its way out of SharpDevelop, as SharpDevelop has been a platform for all free/open source utilities [4].

NCover continues to evolve though, and now it is almost the best option you have for .NET development. It supports many awesome features, such as branch coverage and Visual Studio integration [5].

If you are an author of a similar tool, you will understand how much effort is required to develop a tool as large as NCover. At that time there was no Mono.Cecil nor Microsoft CCI nor Gendarme, which means NCover team have to write almost everything from scratch. So it is reasonable to commercialize this project and receive funding/sell licenses in order to speed up the development [13].

SharpDevelop with PartCover

PartCover was started in 2008 [6] by Dmitri Kashtanov [7]. Several developers have worked on it during the years, but it was never as mature as NCover. There were many issues reported but not fixed until recently, such as

  • .NET 4 support
  • Crash on x64 [8]

Therefore, its last maintainer Shaun Wilde decided to abandon it and started OpenCover [9].

OpenCover’s Pro’s and Con’s

OpenCover is a wonderful project in the following way,

  1. Its Wiki pages answer most of your questions.
  2. Its developer answers almost all queries/questions.
  3. It is feature rich and almost covers all things a beginner/intermediate needs.
  4. Its code base can be downloaded and compiled without any hacking. Just download and compile it.

Shaun has done an amazing job if you review his code :)

However, its weakness is also obvious,

  1. It depends on another project for reporting, Report Generator [10]. Don’t get me wrong. Report Generator from Daniel Palme is good. But since it is not co-evolving with OpenCover, it does not explore every bit of OpenCover as best as it could.
  2. It does not have any IDE integration (no VS addin nor SD addin). Can’t imagine how to write C# programs with an IDE.
  3. Its output format is special.

SharpDevelop with OpenCover

OK. Now it’s my time. I think I am almost the best candidate for this piece of work, as

  • I wrote a SharpDevelop addin in the past, called Alex (AStyle addin [11]).
  • I know PartCover and OpenCover.
  • I have time.
  • I need such an addin for my own open source projects.

So last weekend I forked SharpDevelop and started my hacking [12].

Information on Beta 1

The following are the steps you need to compile my work and enjoy the very first Beta of this addin,

  1. Checkout the code or download the ZIP from https://github.com/lextm/SharpDevelop
  2. Upzip the package if you downloaded the ZIP.
  3. Execute releasebuild.bat.
  4. Launch this customized SharpDevelop build using bin\SharpDevelop.exe.

The current warnings are,

  1. The coverage result is different from the one generated by PartCover. This is something caused by OpenCover’s breaking changes. It is very hard to say which calculation approach is better, so you might learn to adapt to the OpenCover approach.
  2. Not all the unit test cases have passed yet. I need to spend some more time cleaning up.
  3. Based on Shaun’s suggestions I might change the coverage calculation in a later build.

If you meet any issues with this Beta build addin, please leave the detail information under this pull request.

I will spend time fixing them before finalizing the 1.0 release.

References

[1] http://community.sharpdevelop.net/blogs/mattward/archive/2006/01/31/CodeCoverageWithNCover.aspx

[2] http://sourceforge.net/projects/ncover/

[3] http://www.ncover.com/

[4] http://community.sharpdevelop.net/blogs/laputa/archive/2008/01/11/code-coverage-addin-uses-partcover-2-2-instead-of-ncover-in-sharpdevelop-3.aspx

[5] http://www.ncover.com/products/desktop

[6] https://github.com/sawilde/partcover.net4/commit/c4dd480956b61915bcf603e6a87dc90e8e132bde

[7] http://sourceforge.net/users/mr2dark

[8] https://halfblood.pro/sharpdevelop-on-x64-windows-issue-2e845c12cdc1

[9] https://github.com/sawilde/opencover

[10] http://reportgenerator.codeplex.com/

[11] http://alex.codeplex.com

[12] https://github.com/sawilde/opencover/issues/111

[13] http://www.ncover.com/blog/uncovering-the-new-ncover/

This post is licensed under CC BY 4.0 by the author.
Advertisement

Stack overflow issue of DockPanel Suite on Mono

My Last Post on Touch Mouse Mate

Comments powered by Disqus.