Brendan Tompkins [MVP]

Sponsors

The Lounge

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
Project Idea: Generate Unit Test Skeletons from WSDL

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

[Advertisement]

Comments

Christian Weyer wrote re: Project Idea: Generate Unit Test Skeletons from WSDL
on 10-13-2004 10:53 PM
You know what? This is one planned feature for v0.5 of WSCF and has been on the feature list for a long time ;).
Version 0.4 should be out before christmas, so 0.5 maybe in February...?
http://www.thinktecture.com/resources/software/wscontractfirst/default.html
Brendan Tompkins wrote re: Project Idea: Generate Unit Test Skeletons from WSDL
on 10-14-2004 1:47 AM
Christian,

Very cool. Are you going to create a public workspace fow WSCF? I'd love to help out.

Brendan
Christian Weyer wrote re: Project Idea: Generate Unit Test Skeletons from WSDL
on 10-15-2004 10:32 AM
There is a list of reasons - but no, I won't make it public for development. At least not yet.
You can contact me directly, though.
Thanks.
Jason Haley wrote re: Project Idea: Generate Unit Test Skeletons from WSDL
on 10-19-2004 11:21 PM
I am still a newbie at creating unit tests (only been working with nunit for going on two weeks - still learning what mekes a good test), but have done a ton of XML and XSLT.
If you had a sample of a wsdl and the end result (csharp classes) unit tests I could probably whip something up in a week or two.
Brendan Tompkins wrote re: Project Idea: Generate Unit Test Skeletons from WSDL
on 10-20-2004 1:38 AM
Jason! Great. I'll see what I can come up with.
Jason Haley wrote re: Project Idea: Generate Unit Test Skeletons from WSDL
on 10-20-2004 2:33 AM
You can email me at jason[at]jasonhaley.com whenever you get to it.

Add a Comment

(required)  
(optional)
(required)  
Remember Me?