Wednesday, October 11, 2006

It's all about what you've got in your toolbox...

Here is a quick list of what I've actually been playing with over the last few weeks and a bit of a comment on each.. I'll expand on each of these in an individual post when I've got a bit more brain power.

NUnit - This is an obvious one that most people should already know about. It brings the concept of "Unit Testing" to those of us who aren't working at Google, Microsoft or ThoughtWorks. This free “unit testing framework” is the basis of almost everything else I've learnt because without "Unit Testing" or that eventual goal of TDD the other tools don't make as much sense. NUnit was very easy to pickup thanks to the documentation that's available. It's also been nicely integrated into the other tools.

TestDriven.Net – This is an add-on for Visual Studio that allows you to run your NUnit (or various other unit testing frameworks) tests easily from within Visual Studio. The NUnit GUI is very cool but at the end of the day once you get past the cool green/yellow/red you’ll just want to know if you passed or failed as quickly as possible.

FxCop - I don't know about you but it feels like it has been a few years since I last tried FxCop. Back then I tried it.. looked at the giant list of issues (most of which appeared to be a bit silly) and promptly uninstalled it. Well if you're like me and you've grown up a bit it may be time to re-evaluate this little tool. I don't know if it's me or FxCop but the issues it finds seem to be a bit more important now and it wasn't actually that painful to get my project FxCop compliant. O

--- Intermission ---

So your world has started to brighten a bit.. you've got some unit tests written and your project was FxCop compliant last time you checked.. but if you’re like me you've got 50 things to do and trying to remember to run your unit tests all the time has fallen to the wayside. Which of course means that your unit tests are out of date and your code is not even close to FxCop compliant anymore. So does that mean you should give up on this whole unit testing concept? Go back to the way things were? Well No.. it just means you like me need a bit more process and thankfully the tools exist today to bring you that process.

And if you’re not like me and things have been humming along great.. Well maybe these tools will help them hum along just a little bit nicer.

--- End Intermission ---

CruiseControl.Net – If you a tree falls in the forest does anyone know? Well if that tree was being monitored by CruiseControl.Tree they would. CruiseControl.Net allows for “Continuous Integration” or as I like to call it.. knowing to nearly the second that your shit is broken. The concept is simple… every time code is checked into your source code repository (you are using one right? This is your lively hood we’re talking about isn’t it?) CruiseControl.Net will find out and then the magic begins. Using CC.Net with a little help from NAnt (explained below) your code is compiled, and optionally NUnit and FxCop are both ran. If any problem occurs you are notified either via email or via the little CC.Net system tray utility. Either way you can yell at the numbskull that just broke the code (or quickly fix it before someone else realizes that you’re the numbskull that broke it)

NAnt – Personally I started using NAnt for two reasons. The first being that it was the only way I could get CC.Net to build my application but more importantly I needed to be able to do a complete build, unit test, fxcop cycle with a single button click. NAnt is a tool that lets you build scripts to carry out various tasks. The fun thing is that while NAnt comes with many tasks there is also a community effort around building new tasks. So if you’re stuck using VSS as your source control (better than nothing.. worse than anything else) and you notice that NAnt doesn’t contain a task to retrieve your source code then NAntContrib will come to the rescue. Then it’s just a matter of putting together a build file (easy as pie using all the help available online) and you’ve got yourself a build process.

NCover – I haven’t actually gotten this to work.. mainly because the help sucks and there isn’t a lot in the blog sphere on how to set it up. Once I figure it out I’ll do a HOWTO. Oh and it appears that there are two seperate NCover projects. I'm using the NCover.org one.

ReSharper – If you are a C# developer and you are not using this tool.. download it ASAP.. print out the default key map and get ready to stop using your mouse for so much.

I think at the end of the day all these tools are really about one thing. Process.. or as I like to call it "Forcing me to actually have a process". Each tool adds a bit to your individual or team process and once you have them all in place and see them actually help your development efforts you can't imagine how you got by without them.

1 comment:

kiwidude said...

Shane,

If you are having difficulty with NCover just take a look at the forums on NCover.org. There are a ton of examples, workarounds, common problems etc documented. You can also use the latest build of NCoverExplorer to generate the necessary command line/NAnt/MSBuild script. I've also written custom tasks for automating NCover you can find in NCoverExplorer.Extras.zip.

NCover is not without it's issues (the FAQ is shockingly out of date, and the 1.5.5 release has a number of problems) but most things are covered in the NCover forums. Feel free to post in there if you are having problems and usually someone can help...

Good luck!
Grant