Best practice for unit tests that rely on internet access?

David Precious davidp at preshweb.co.uk
Sat Apr 30 23:34:19 BST 2011


On Friday 29 April 2011 08:33:47 Leon Brocard wrote:
> If the module is all about testing a live service then by all means test
> it. Unless it takes too long, or costs money, or might change in the
> future when you don't have time to update the module...

Arguably, if whatever service the module talks to changes in the future in a 
way which stops the module working, failing test reports helps to highlight 
that; even if the developer doesn't have time to fix it, it highlights to 
potential users that the module "doesn't work" any more.

That, to me, is a good reason to offer the ability to test against the real 
service.

On the other hand, you could end up with incorrect failure reports when the 
service is temporarily unavailable, or cannot be reached due to a restrictive 
firewall, for instance.  Having to "force install" because the tests fail 
because the firewall hasn't been updated to allow connections yet isn't too 
pretty.



More information about the london.pm mailing list