I find myself depending on the following tools continually while working with Brownfield Software or new development. They are both excellent additions to your own toolbox.
NCrunch is an excellent unit testing tool that continually runs your unit tests while you are working. It runs in the background and will periodically build the application just as you have it. Assuming it builds, NCrunch will then run all the unit tests that are affected by any changes you may have recently made, then show the results of those tests.
When I describe this tool to others, their first comment is usually about “how annoying it must be” to have tests constantly running, and at first it was. However, I put the NCrunch display to the side of my left-most monitor and just let it sit there. I quickly became tuned to the color red in that window, so that now as I’m coding if something turns red in that window I notice it. As long as everything is green, though, it fades away out of site.
This tool is excellent in detecting when I break business rules that I’ve forgotten about. I was recently picking up a project that I haven’t done anything with in a quite a long time. I opened the project, all my tests were green, so I started coding. I made a small change to the code an a few minutes later many tests started turning red. I then remembered there was a quite complicated set of approvals that need to be acquired before a particular business process can be completed and my new code was ignoring those requirements. Just in that instance, NCrunch paid for itself.
There are many other features of NCrunch that make it a valuable tool, such as the code coverage metrics, but it’s the continual test running that I get the most value out of.
I’m a fan of all Telerik tools – they are well thought out, and useful. JustMock is a mocking tool published by Telerik that I would not be able to do my job without.
Mocking is a way of imitating the actions of a module without having to change the module itself. It’s a powerful way to test any application, but many mocking frameworks are challenged by Brownfield Software projects (I’m looking at you, Moq). This is because these frameworks assume your application is already modular and that the objects that need mocking are well defined. This is not the case in Brownfield Applications.
JustMock solves this problem by being able to mock any object, not just interfaces. It is capable of mocking System objects and static objects, both of which are difficult or impossible to do with other frameworks. In fact I’ve been able to mock HttpContext in order to test my web page controllers, and JustMock is the only package I’ve been able to find that does this reliably.
As I said, I’m a Telerik fan-boy, but this next tool can be performed well by Resharper as well. When it comes to working with legacy software having a very good renaming tool is essential. Both JustCode and Resharper do this task very well, tracking down and changing names of methods and variables wherever they may hide. Each tool can also reorder method parameters in code, and lots of other house cleaning duties.
If you are updating a brownfield application, or any application for that matter, these tools will make you much more productive.