views:

36

answers:

2

You know how they say, "There's an app for that"? Well, is there a VS plugin for this ................. ?

I want to be able to right click on a method and select "Create unit test method ..." and have it generate an nunit stub in a particular place in my project tree. So for example. I have a TheNextBigThing library with an Idea class and a MakeMeRich() method. I want to have it, for example, create a unit test method in my Tests project in a sub-folder named TheNextBigThing, in a class named IdeaTests.

I know. I know. All the TDD advocates will tell me I'm doing it backward, but humor me. I have some code I want to retrofit with some tests, and I sometimes write methods before tests.

If it doesn't exist, any pointers on how to write it myself?

A: 

It wouldn't be too hard to get the addin started. Since you have VS already, simply create new project > VS Extensibility. :)

You'll most likey have to learn some codegen unless you utilize a templating language of some sort.

Me? I think it's a cool idea and I'd like to see it implemented. Start it up, share it on github (or similar) and watch it grow.

Chris Martin
+1  A: 

If you are running Visual Studio 2010 Professional or Premium you have the option to create a unit test with MSTest by right clicking on the method.

Also, I would suggest using Pex. Pex will create the unit test for you, in addition to all unit tests needed to achieve 100% code coverage of a particular method.

dretzlaff17