I'm starting to have difficulty testing my apps by seat-of-the-pants methods, and figured it's about time to start learning how to use proper tests in Perl. I've looked at various docs, including the Test::Tutorial POD, and Test::Simple and Test::More, and some other Perlmonks threads that didn't really cover this.
What I'm not grasping is how one would use these in a CGI enviroment, esp. with backend database access as well. If, in order to do
the most basic test, I need to set/read cookies, retrieve session info and user access levels from
a DB, and that sort of thing, it seems like it would be really hard to do.
And that doesn't even consider testing an app
that generates forms and then processes/returns results from a database, or, worse, testing something that adds data to a database.
I suppose one could use something like WWW::Mechanize to perform tests on running CGI apps, but this seems like a different thing than creating and running a test suite.
My immediate inspiration is that I have a search function that allows a user to search on various fields, and after running with no problems for some time, I got a failure because one of the lesser-used fields had an improper verification routine attached to it, and it took a long time before someone chanced to enter just the right improper value to trigger the failure. But I couldn't figure out how to create a non-manual test for this.