views:

350

answers:

4

Hello,

I am writing a winforms application and eventually I would like to write unit test for this application from the DAL, and Biz Objects layers etc.

Does someone know of a FREE tool that can recieve the path to an assembly and then output unit test stubs with matching signatures for the assembly.

Any configurable options like "public interfaces only", "test framework choice", "language choice" would be a plus.

I at least would need this tool to emit vb.net against nunit.

Thanks.

Seth

+1  A: 

Last I heard, the recommended method of unit testing was to write them as you develop the functionality in a test first style. Auto-generating unit test stubs, in my mind, would just result in a whole bunch of unimplemented unit tests which add no value and will most likely have very awful generic names that don't describe the behavior being tested.

On the other hand, maybe I'm just misunderstanding your question...

mezoid
mezoid,Thanks for your answer. I agree that the ideal situation would have been to develop my test suite as I was writing the code. (I also want world peace and an end to world hunger). (Just making a little joke...no sarcasm intended.) In my case I am too far down the path to do that so what I would like to do is slowly begin to implement unit testing against my DLLs bit-by-bit. What your saying is ideal. What I am saying is "better than nothing". That said...I guess I could just write them one by one and not generate them. But to have them stubbed out seems useful to me.
Seth Spearman
A: 

MS Unit test build into VS2008 can create stubs (using Reflection) in your behalf.
I found it very useful in most cases.

Maciej
+1  A: 

Take a look at Pex from Microsoft Research.

Mark Seemann
But:1) Pex generates MSTest stubs by default and Seth asked for NUnit. You need extra configuration for that (guide: http://blog.benhall.me.uk/2008/08/how-to-have-pex-generate-nunit-mbunit.html).2) Is Pex free? It's use is restricted: Academic Release (MSR-LA - non-commercial only) or DevLabs Pre-Release (Microsoft Pre-Release Software License - "to evaluate and test the software").
The Chairman
Here is post saying you can use Pex for commercial purposes:http://coolthingoftheday.blogspot.com/2009/01/pex-license-updated-you-can-now-use-it.html
Maciej
EDIT: "...only allowed for those who own Visual Studio 2008/2010 Team Dev or Team Test"
Maciej
A: 

There is a tool called Pex that not only makes the stubs, but also fills in tests for you. There's also a video online.

edit: Mark Seemann beat me to it! Hopefully the links are still useful.

redtuna