A while ago I was asking around about automatically generating unit tests. I know, I know, you should generate your unit tests before you write your code (and of course we all do this ;) ) but, what if... say... you inherit code without tests? What if you were in a hurry? What if you haven't bought into test-first, but you'd still like to unit test? It'd be nice to have a tool that could generate tests for you.
Peli has written some code that will generate tests. He says it's experimental, but I did manage to get it to spit out some empty unit tests from some of my simpler dlls. The method he uses to do this is way beyond my skill level and understanding, but I did think of another method for generating tests that I think I could, given time that I don't have, manage to crank out...
My idea is to use XSLT to generate unit tests from the WSDL file. This would work right? Like I said, I don't have time for this, but I wanted to put the idea out there in case someone else does. Here's how it would work: Point your tool to your service's ASMX file. The tool would request the WSDL, and using XSL, generate empty unit tests. You could even have it do wire up some Asserts based on the service description.
I did find an article here that has some basic XSLT that does WSDL processing. This should help get anyone who is interested started.
I should give away something contest-style if someone codes this. How about a dry erase marker? Um.. Highlighter? Swingline stapler? Let's see, pushpins? Can you tell that I sit next to the supply cabinet?
-Brendan
Posted
10-13-2004 11:02 AM
by
Brendan Tompkins