Tuesday, May 15, 2007

Reflector, Doubler and Unit Testing

Update: the latest versions of Reflector and Doubler are working well together.

I just noticed that Jay Flowers has released a version of the Doubler Add-In that works with the current Reflector by Lutz Roeder. I tried installing Doubler in a sub-directory under Reflector, but it failed to load, so I had to move it into the Reflector directory. The current version of Doubler generates test stubs with a mis-spelled attribute (Memeber instead of Member), but it will generate test stubs, interfaces, recording wrappers, mock objects, etc. It seems like it will be quite handy, with support for NUnit, MBUnit, etc. although Doubler forgets all of your settings every time you move to a new class. That is almost a deal breaker there, but at least you can select an assembly and generate all tests at once. I have to change the output language to c#, change the output path (or just build where the tool wants to go, and copy it), change the default test framework, and set "WithTestAttibutes" aka "With Test AttRibutes". As a good citizen of the open source community, I intend to submit patches for the spelling errors (one is found in namespace Doubler.Templates.UnitTest, file TestTemplate.cs, method VisitTestGenerateMember). I will also look into the configuration issue when I get time, although I know that the path C:\Temp is hard-coded into ReflectorDoubler.

The only thing that bugs me about Reflector is that the code has a time bomb in it, and I am forced to upgrade Reflector every few months (or maybe lie to Windows about the current date). I am sure he does it to reduce bug reports from stale code, and maybe to force developers to try out his new code, but it means that I may have to upgrade any add-ins as well, and I may loose my tool set until critical add-ins are updated. I know, doubler is open source (Reflector is NOT!) and if I have enough time, I could maybe build it, but the doubler project has some HUGE dependencies, and has very elaborate and complicated directory structure. I tried building it from the Google Code repository, but Lutz had changed parts of his plug-in interface, and I did not have time to bother with it. I knew better than to fall into that time trap.

Speaking of time traps, I think that I am doing better at managing my time. I have learned to write clean and simple code where possible, and I am less obsessed with optimizing code that might run once a month. Code that is run rarely needs to be very readable, and easily maintained (aka fixed).



Anonymous Anonymous said...

I only needed to update my add-ins when moving from Reflector 4.2 to 5.0. For all other versions the updated worked fine.

May 15, 2007 3:30 PM  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home