VSTS, Visual Studio, VS2010,

TDD with Visual Studio – to do or not to do

By Jeff Levinson • on November 8, 2007

Check out a new article that I wrote for Redmond Developer News in the latest issue. Please drop me any feedback here!

Comments

By Chris Brandsma on November 8th, 2007 at 12:56 pm

Nice article, but two things:

1. NUnit and MBUnit are generally preferred over MSUnit by 95% of the community. MSUnit has a few nasty bugs in that still haven’t been addressed as of VS 2008. See Roy Osheroves blog. http://weblogs.asp.net/rosherove/archive/2007/10/16/unit-testing-in-vs-2008-still-not-there.aspx
Pick up Test Driven.Net or ReSharper for test integration.

Check that, whatever you do, pick up ReSharper. You wont be sorry.

2. Proper unit testing cannot be done without mock object support (which is not included in MSUnit, NUnit, or MBUnit). Check out Rhino Mocks for that.
http://www.ayende.com/projects/rhino-mocks.aspx

3. Understanding Unit Testing is the easy part. Figuring out how to write testable code is the hard part. If you are looking for a place to start, learn about “Separation of Concerns”. Jeremy Miller has a nice post on it here:
http://codebetter.com/blogs/jeremy.miller/articles/129542.aspx

After that, study MVP and MVC as a starting point for doing just that.

By Jeff Levinson on November 14th, 2007 at 8:22 am

Thanks Chris, sorry it took so long to write back. Your points are excellent but… One of the things about this view is that there is only one way to do it “correctly”. I like to think that even without following TDD to the nth degree that developers can get benefit out of it. And there are plenty of add-ins that work with unit testing in Visual Studio. Granted, we would all like to see more built in but I don’t think Microsoft can ever really compete with the full resources of the open source community so their add-ins are a blessing! :)

By MikeAzocar on November 14th, 2007 at 1:57 pm

I agree with some of the points each of you made.

Chris. You are right, Resharper makes TDD so much easier.

Jeff. I agree that there is more than one way to be successful with TDD. You have to be flexible and take the practices that work best for the project and the development team.

Trackbacks

Leave a Comment

You must be logged in to post a comment.