Re: Best practice for unit tests that rely on internet access?
On 29/04/11 02:15, Toby Wintermute wrote: > c) Try to test if there's a working connection, and silently skip the > tests if not? (Risks skipping tests if the connect fails for other > reasons than no outbound HTTP allowed) This module might be useful for the test: http://search.cpan.org/dist/LWP-Online/ 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... Leon
Re: Best practice for unit tests that rely on internet access?
On Fri, Apr 29, 2011 at 11:15:58AM +1000, Toby Wintermute wrote: > What is the best practice for writing unit tests that rely on internet access? > > ie. You have a CPAN module which is all about talking to a web > service.. So you have unit tests that do just that. > What if the system testing it doesn't allow HTTP connections out? The > tests will fail.. You're running into the limitation (if you want to see it as that) that modules only really have one type of test. This isn't usually a problem, but in the case you mention it is. I agree that unit tests should mock the service. However, system tests (or whatever you happen to call them) should test the actual service. My suggestion would be to run mocked tests by default and provide a method to run live tests should the user want to do that. The user should also have system tests for their whole application that will test the live service too. -- Paul Johnson - p...@pjcj.net http://www.pjcj.net
Re: Junior-mid level Perl
On 28/04/2011 09:09, Sue Spence wrote: On 28 April 2011 08:45, James Laver wrote: Their tobacco old fashioned[2] is quite an impressive concoction and frankly their entire cocktail menu looks delicious. I've been there since to drink cocktails and not eat. [1] http://www.thehawksmoor.co.uk/home_press_brunch.php [2] http://www.flickr.com/photos/hawksmoor/5191325159/ What is in a "tobacco old fashioned"? According to their cocktail menu: Bourbon or Rye stirred with Sugar & homemade Tobacco Bitters (Punch Habana, Hoyo de Monterrey or Partagas D No.4) Cigar tobacco infused bitters instead of the more usual Angostura in a whiskey old fasioned. I rather enjoyed the one I had. Their menu has a bit of history about it and all of their other drinks: http://www.thehawksmoor.co.uk/downloads/HM_Cocktail_2-10-10_web.pdf Although, of course, it's much better to read the menu when you're there :) --billy -- http://cowfish.org.uk - Random http://bbblog.org.uk - Booze http://billyabbott.co.uk - Me
Re: Junior-mid level Perl
On 28 April 2011 11:15, Victoria Conlan wrote: > >>> I was just thinking that surely a Bloody Mary is 1 of your 5-a-day. >> >> How about sloe gin? > > If you make sloe gin you can use the gin-soaked sloes later as an ice-cream > topping, apparently. :-) > > (We did it with vodka raspberries, which were very very nice!) > 'Used' sloes can also be used in biscuits, flapjack and presumably cakes. I was thinking of using up a cupful in a fruitcake this weekend.
Re: Junior-mid level Perl
'Used' sloes can also be used in biscuits, flapjack and presumably cakes. I was thinking of using up a cupful in a fruitcake this weekend. Splendid idea. I tend to win or come 2nd in the local gardening club fruit cake making competition (yes, I was one of those who once came 3rd in a competition with only one entry! I think it may have been for my leeks) due to the vast amounts of alcohol I tend to apply. My next door neighbour (and club president seems to consider this 'cheating'. Pfft, I say. And pfft again. (nb, alcohol applied to the cakes, not the judges. Although now I think about it, that doesn't sound too bad an idea either ...)