I prefer offline tests to the maximum extent possible. The only reason I can think for having real online tests is to detect when the web service API itself has changed and created an inconsistency. The problem with online tests is that we're introducing another variable to the equation, when unit testing is directed towards predicting behaviour from a known set of constants.
Or in other terms - are we testing the code, or the web service API ;). It does pay to have online tests somewhere if you think the API being used is likely to see difficult to detect changes, or if it's so complex as to make reverse engineering of the likely request/response pairings difficult to maintain. P. Pádraic Brady http://blog.astrumfutura.com http://www.patternsforphp.com OpenID Europe Foundation ----- Original Message ---- From: Simone Carletti <[EMAIL PROTECTED]> To: [email protected] Sent: Monday, December 3, 2007 8:43:26 PM Subject: [fw-general] Online vs Offline unit tests Somewhere in Dev Zone (http://framework.zend.com/wiki/display/ZFDEV/Home) I read a paragraph where developers were strongly encouraged to develop offline focused unit tests rather than tests that rely on a connection to the web service. I had a quick look to the most part of Zend framework webservice classes and I really enjoyed Zend_Feed approach. This is why I chose to follow Zend_Feed example to develop Zend_Service_Technorati unit tests (http://framework.zend.com/svn/framework/trunk/incubator/tests/Zend/Service/Technorati/). Today I fixed a bug related to Zend_Service_Yahoo that is based on a different approach. Zend_Service_Yahoo has an offline unit test file for the most common exceptions but uses online Yahoo! API for running the main part of unit tests. The bug would never be pointed out with this approach because you don't know in advance web service response and you cannot test if data by the class matches XML response. I was wondering which is your favorite approach for web service unit tests or which one you would suggest to use. Do you create offline based scripts or do you prefer to query the end user web service? -- Simone -- View this message in context: http://www.nabble.com/Online-vs-Offline-unit-tests-tf4939193s16154.html#a14138425 Sent from the Zend Framework mailing list archive at Nabble.com.
