Improve your code with nCover

Whether you are a beginner or a seasoned developer, then one your most important goals should be to constantly strive to improve your coding skills. For me, writing clean, efficient and purposeful code is important both for the people involved in my projects and, of course, for the project itself. As a consultant, I participate in a large number of different projects and I make it a priority to ensure that my work is maintainable, testable and readable. There are hundreds of books, articles and courses about coding standards and practices that can help you become a better developer by embracing and applying those standards.

Over the years, I have had the opportunity to work on a variety of projects, some with relaxed (if any) coding standards and some with some really rigid, inflexible rules about syntax, layout etc. When working within a team, it is easier to establish a set of rules and follow them in order to have consistency within the codebase and at the same time ensure that everyone's on the same page regarding the coding standards. These rules can be unofficial or enforced through numerous tools available for each IDE.

Recently, I was offered the chance to test one of these tools: nCover. I can honestly say that it has become an indispensible tool. If you haven't heard of it before, nCover is a 3rd party tool that integrates with Visual Studio to provide real time code coverage statistics for your codebase. nCover, on version 5 as we speak, has really helped me work through my code in a holistic way to discover areas that were either poorly written or not adequately tested. nCover is my "pair programmer" that provides invaluable feedback that allows me to improve the codebase and it is for this reason that has moved to the top of my tool list.

nCover offers 3 products that work great together in order to gather, analyse and present your code coverage. Assuming you write unit tests (TDD anyone?), then nCover will generate detailed statistical reports that can drill down to very fine details if you need to find out exactly what's wrong. The 3 products in question are:

  • Bolt: this is the VS add-in that allows you to run and analyse your tests. When installed, you get two new windows within VS:
    • Bolt Tests: runs your unit tests
    • Bolt Code Coverage: statistical analysis of your code coverage
      You also get a Menu entry where you can select/deselect features, such as "Highlight Code", or edit nCover specific settings.

  • Desktop: this is a standalone application that provides a more in-depth analysis of the result data gathered by Bolt and also offers a quick glance to help you quickly identify issues with your code coverage.

  • Code Central: this is another standalone application that seamlessly pulls together your coverage data from any of the NCover products used within a team. This is more of a project management dashboard that helps developers, managers and QA analysts stay on top of things.

nCover is a very powerful tool with some very handy features. It comes with more metrics that you can count and it is incredibly flexible. The official website has many tutorials and videos that can help you quickly get to grips with the various features, in effect helping you improve your code with only minimal upfront "investement" from your part. What is more, I believe that working with nCover in place forces you to continuously think how to better implement a feature or write code that is more testable. Combined with TDD, then the combo is even more powerful. It almost feels like nCover turns coding to a game ("gamefication") where your goal is to try and achieve a coverage score as close to 100%, as long as this is justifiable or necessary. Whether you are part of a team or a lone developer, code coverage can become a game instead of a dreadful chore.

So, what are my overall impressions of this product?

Pros

  • Bolt integrates beautifully with Visual Studio
  • The tests run fast and the results are easy to read and understand
  • Works well with Resharper
  • The analysis data is very comprehensive and allows you to drill all the way down to the code line that requires attention
  • The Desktop is also extremelly handy for glancing over coverage trends and for viewing the data outside Visual Studio
  • The "Highlight Code" feature is great as it provides you with immediate feedback
  • There has been a lot of attention in the way that nCover works alongside the main IDE to provide non intrusive yet helpful visual cues about your code quality
  • Bolt works great in all VS themes, though you may have to tweak with the color schemes, especially on the dark theme.
  • The overall feedback and analysis are, personnally, invaluable if you are serious about efficient and bug-free code
  • Turns code coverage into a "fun" game, though some may see this as a negative.

Cons

  • The Desktop price is a bit too high if you are a single developer working on small scale projects. In this case, Bolt should be more than adequate for your needs
  • During testing there were a few issues, however the team was quick to address the minor bugs and get back to me with a fix. Great to know that support can be counted on.
  • No support for VS2015, however it's still early days so not a big issue

Conclusion

nCover is a mature product that should be an integral part of your tool set. I have been able to improve many of areas of my code that I wouldn't have been able to pinpoint without this nCover and, therefore, I can say without reservation that it's a great piece of software.

I hope you found this review helpful and I would be very interested in finding out what tools you find useful or indespensible in your development environment.

P.S Make sure you follow me on Twitter @christosmatskas for more up-to-date news, articles and tips.


  • Share this post on