Tuesday, March 17, 2009

What tools can I use to test and ensure quality in C# code?

First, you need to define your priorities in terms of code quality, and specific metrics your code needs to meet. Do you want to detect and prevent code duplication? Code complexity? Or simply ensure a coding standard is followed?

Once you have your objectives and metrics planned, you could use these tools (which I've used on a past project):
Finally, it's important to plan time upfront in the project to tweak these tools so that they output just enough information that will be useful to the development team. FxCop for example can be quite verbose by default, and making sense of its output can be a challenge. The point is to provide an automated support to your team that they fits their needs - the extra days you invest to get the tools working just right will pay off in the long run.

2 comments:

  1. what about resharper? (http://www.jetbrains.com/resharper/)

    Code analysis add-in to Visual Studio for C#; version 4.0 (not released yet and no known date on the web site) advertises to work with C# 3, Visual Studio 2008 and WPF. Similar to RSM, but it checks and analyses code on the fly as you are typing it in supplying suggestions for conforming to the better coding guidelines.

    Additionally, there are other features such as:

    configurable code style and the ability to propagate the style to other developer machines.
    ability to block select code and reformat according to the style preferences

    ReplyDelete
  2. For code duplication detect instead of simien, I have used this free tool: PMD Copy paste detection (http://pmd.sourceforge.net/cpd.html)

    ReplyDelete