Howdy Monks,
I've got a web scraping script. It works fine, except it's a PITA to test the program logic, because the conditions under which it scrapes an external web site only happen for about an hour a day (the information being scraped is time sensitive).
In order for me to test the script's logic outside of that one hour a day, I have to fake:
I currently accomplish this by setting a "TEST" flag in my code, and at certain junctures testing for it and running different code if I'm testing. Then there's also some bits of code that I just comment/uncomment during tests. I'd like to rewrite the package that contains my obj/methods so that when the object is created as a "test", the usual methods will not scrape the external site, query the DB, etc normally. Instead they'll execute under testing conditions, so that I can test program logic during other times of the day.
Any thoughts on how, generally, to think about writing code to handle this kind of thing?
Thanks in advance,
AH
Using perl 5.8.6 unless otherwise noted. Apache/2.0.54 unless otherwise noted. Fedora Core 4 (2.6.11-1.1369_FC4) unless otherwise noted.
In reply to web scraper testing by alienhuman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |