my @forms_no_password = forms_with_no_password($host); my @forms_to_add_agency = forms_to_add_agency($host); my @other_group_of_related_forms = other_group_of_related_forms($host); submit_forms_ok( $mech, @forms_no_password ); # .... sub forms_with_no_password { my $host = shift; my @forms = ( { 'test_description' => "search_phrase='' category_search_form", 'url' => "http://$host/", 'expected_content' => "Sorry, we don't have any program categories", 'number' => '1', 'button' => 'Search', 'fields' => {}, }, { 'test_description' => "search_phrase='' agency_search_form", 'url' => "http://$host/", 'expected_content' => "know of any agency whose name matches", 'number' => '2', 'button' => 'Search', 'fields' => {}, }, ); } sub submit_forms_ok { my ($mech,@forms) @_; my %params; for my $form (@forms) { $params{form_number} = $$form{number}; $params{fields} = $$form{fields}; $params{button} = $$form{button}; $mech->get( $$form{url} ); $mech->submit_form_ok( \%params,$$form{test_description} ); $mech->content_contains( $$form{expected_content} ); } }