The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Testing Web Services


I've just started my first SOAP project, and I'm looking for a TDD approach. With that in mind, at some point I concluded that a service stub would be nice for my tests. But as I'm thinking more, a Soap client stub seems more appropriate.

I mean, I'll have a wrapper class/package for the real web service(that should add some domain logic to the whole thing), which in turn would use a Soap client to get access to all the data. So, having a setter/getter for the Soap Client brings me loose coupling and, at the same time, the opportunity to inject a Soap client stub inside for my tests.

Does all these things make sense? In which cases should I consider a service stub(by that I mean a clone of the real web services that runs on my local machine)?

Are there any aspects that I've missed?

Thank you

P.S. I'm using PHP5 for the implementation
Ionut Gabriel Stan Send private email
Friday, April 25, 2008
I personally would think that making a remote method call (like SOAP or WCF) turns a unit test into an integration test.

Whether that's OK or not depends on your viewpoint towards testing.  But in my case, I would say it's a bad thing because now your unit tests are no longer self-sufficient and don't run as fast.
Saturday, April 26, 2008
You're absolutely right that a remote call would make them integration tests, that's why I decided to go just with unit tests at this time. There will be a stub soap client with hard coded methods, named exactly after the methods in the WSDL, and these would return the structures against I'll build my unit tests. Some of the tests I have earlier considered for the WS wrapper will now be moved to the soap client unit tests and assess both later into an integration test (I hope so...).

Thanks for your reply
Ionut Gabriel Stan Send private email
Tuesday, April 29, 2008
If this is your first SOAP project and you want to apply TDD, you may look into tools like SoapSonar, SoapUI (or similar commercial tools) that automatically can create executable test cases (sometimes even a service simulation) based on the WSDL and Schema files.
Monday, May 19, 2008

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz