Brendan Tompkins

Sponsors

The Lounge

Wicked Cool Jobs

News

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
ReSharper as a TDD Tool

One of the things I've been thinking is awkward in the Test Driven Development process was the step where you write a test that for a method that doesn't yet exist.   If you follow the TDD process as laid out by James Newkirk, you're supposed to write your test case, code as if the method exists, then compile.  Of course your code won't compile, since you haven't yet implemented the method.  This is your “GO“ ticket for actually implementing the method.

This just seems broken, mainly because I  have to use my compiler, not NUnit as a part of my TDD process. Compiling is slow, especially compared with running a test. And compiling when I know it's going to break seems like a waste of time.   TDD has reduced the number of times I have to compile in a day, and I want to keep it that way.

But, if you've used ReSharper, it offers a great feature that eliminates this compile step.  This is really cool, and it actually makes TDD much easier.  Here's how it goes. Write your test for your method (the one that doesn't exist yet).  ReSharper will give you an option to implement this method.  Choose this option.

ReSharper will open the code file and add the method, using the types from your calling code. It even raises the System.NotImplemented exception for you!

This is cool stuff, and gets rid of this awkward step!

-Brendan


Posted Fri, Oct 22 2004 8:42 AM by Brendan Tompkins

[Advertisement]

Comments

Josh Pollard wrote re: ReSharper as a TDD Tool
on Mon, Oct 25 2004 3:17 AM
I usually just skip the step of compiling at that point since I know it won't compile. I liken it to skipping steps in math (by doing them in your head).

The functionality that you showed in resharper looks nice though! I would love to have that!

Add a Comment

(required)  
(optional)
(required)  
Remember Me?
Devlicio.us