This is an excellent tool, but it has a bad habit of dying in a middle of a test sequence if a bad URI is encountered. It happens on line 567 of API.pm, I'm looking at r.1.29 of it. In my book, it's a bad thing - I'd rather have it to fail the test and continue with the program.
Enclosed is the little module that does just that. To use it, you have to add it into the list, something like this:
my %globalParams =
relative_urls => "yes",
timeout => $timeOut,
default_report => "no",
my $webtest = new HTTP::WebTest;
I think it's worth considering for the maintainers of the code to include such behavior as a run-time parameter on a more permanent basis.
-------------------- MuteBadURI.pm ------------------------------
# The problem is that HTTP::WebTest's API.pm module dies if an improper URI is passed along. This
# happens quite often, especially if HTTP::WebTest::Plugin::Click module is used - when, for
# example, no suitable URL or button is found in a result page to click on. The API's
# run_test() method dies thus canceling the whole test sequence.
# This plug in fools API.pm by replacing it's bad URI marker with it's own and allowing all
# subsequent tests in a chain to proceed and fail (that's a bad URI) peacefully.
use base qw(HTTP::WebTest::Plugin);
my $API_BAD_URI = "http://MISSING_HOSTNAME/";;
my $MY_BAD_URI = "http://0.0.0.0/";;
my $self = shift;
if( $self->webtest->current_request and ($self->webtest->current_request->uri eq $API_BAD_URI) )