I've been maintaining an automated test suite for a fairly complex web application via mech for a while. mech++.
I see a few things you might want to look at in your code:
- This snippet:
cmp_ok($mech->form_name('login'), '==', undef, "Logged in correctly. Page no longer shows logout option.");
Should probably say "Logged in correctly. Page no longer shows login option."
- I'm guessing there is a mechanism for users to log out insead of remembering rm=logout. Instead of hard coding that, why not verify the logout functionality exists as displayed by the user and when the click it, it logs out.
- Instead of just checking for $mech->success, perhaps you should check for some content in the page. Just because your CGI returns 200 doesn't mean that all is "ok".