I neet to test a couple of SOAP webservices. What types of tests can I run?
+1
A:
Stubbing and Mocking Web Services http://www.phpunit.de/manual/current/en/test-doubles.html
Priyank Bolia
2009-12-23 10:40:12
Thank you. But I was looking for functionalities to test the webservice itself and not the corresponding PHP code.
powtac
2009-12-23 10:44:16
then you have to implement those webservices in PHP and call those implementation functions.
Priyank Bolia
2009-12-23 11:05:07
+1
A:
Testing a SOAP web-service will be quite the same than testing a "local" method : you'll have to call that method, passing it some parameters, and chechink the return value, to verify that it corresponds to the parameters you gave.
Of course, with web-services, the call will be a bit more complicated, as you'll have to work with SoapClient
to call the method, but the idea will still be the same.
The biggest problems I see are :
- Web services calls are slow (they go though a network), which means your tests will take time to execute -- which means you won't be able to execute them as often
- With a webservice, you potentially have more than one possible reason for failure ; which means you'll have more troubles finding out why a test failed :
- It can fail because there is a bug -- that's the ideal case
- But it can also fail because the remote server is down
- Or because the network is down
- And probably quite some other possile reasons
- Of course, as the code will be executed on a remote server, and not on the machine that runs PHPUnit, it'll be much harder to get code-coverage (for instance)
Pascal MARTIN
2009-12-23 12:58:31