in reply to Catalyst Form test

submit_form_ok only checks whether the page returns a HTTP status code of 200, nothing else. If you return custom messages as error messages, you will have to parse your returned page and check that there is no "message" bar with an error message in it.

Replies are listed 'Best First'.
Catalyst Form test-more questions
by wst (Acolyte) on Apr 28, 2009 at 13:23 UTC
    Hi, Looks like I need more help with this one. I am novice to Test::WWW::Mechanize::Catalyst.

    I have a simple search application. First page(and url), asks for one input mgid. If mgid is correct, it will display new page (same url) if mgid is not of correct length/format, an error message is displayed on same page (uses c->flash->{message} format to display error message). if mgid is not found, another chance for checking with shid is given (same url /page but with words SHID : rather than MGID in first instance).

    Can a test be done, to check following:
    1>check if form HTTP status code is 200 (using submit_form_ok for that),
    2> if 1 is ok, then check the page for words /not correct/.
    3> if 2 is not ok then check the page for words /SHID:/
    4> if 3 is not ok, then check page for words /Found/.

    Could such a test be done? Purpose of doing such a test to make sure the flow works for all possible combination. Any suggestion/help would be appreciated.

    Thanks for the quick response, time and help in advance!
      figured it out. thanks!