3 ms·
Thank you, that makes sense and why TDD is so worthwhile for me to start with. For external services (I rarely write code that doesn't rely on at least one SOA
by porker 11y ago
Thank you, that makes sense and why TDD is so worthwhile for me to start with.
For external services (I rarely write code that doesn't rely on at least one SOAP endpoint) is there any alternative to mocking the service and the response data? And then should your tests also verify that the remote service works according to its contract?
As it would affect data in the live system, I cannot think of a way to safely do it, but 3rd party systems have 'changed' their behaviours before now, and that's a horrible bug to track down.
- jerf 11y ago"For external services (I rarely write code that doesn't rely on at least one SOAP endpoint) is there any alternative to mocking the service and the response data?" In practice, no. Though I prefer some variant to dependency injection to "mocking". I consider the testability a first-class concern and code accordingly. Exactly how this manifests varies suprisingly widely between various languages. You don't mention your language, so I don't have specifics. "And then should your tests also verify that the remote service works according to its contract?" Yes, but rather than thinking of that as "automated testing", you're better off thinking of that as "service monitoring" that happens to look like automated testing. Consider something like: http://n8v.enteuxis.org/2011/06/integrating-nagios-with-test-driven-development/ http://n8v.enteuxis.org/2011/06/integrating-nagios-with-test...