in reply to HTTP::Form and invalid radio button values

While writing these tests I found out that I can not submit a form using WWW::Mechanize with an invalid entry entered into a radio button field. WWW::Mechanize uses the HTML::Form module to handle form parsing/filling/submitting, and that module happens to be very strict about the values you can assign to a field that is a radio button (or a select box for that matter)

Well, what do you expect your Web Browser to behave on radio boxes? Will the browser allow you to select some non-existant radio button? WWW::Mechanize is imitating what a web browser is doing - by not allowing you to make invalid selections. Somehow I fail to see why you would want to do invalid radio button selection, sounds more like hacking to me. ;-)

  • Comment on Re: HTTP::Form and invalid radio button values

Replies are listed 'Best First'.
Re: Re: HTTP::Form and invalid radio button values
by pg (Canon) on Dec 19, 2003 at 05:48 UTC

    I think his test case is valid. When you test, you don't assume that the users will always use the system in the way it is supposed to be, you don't assume that the other applications that interface you will always behave as it should be. We not only test normal cases, but also test exceptional cases.

    If your system talks to a browser, the browser can be buggy, so you probably want to test what if the browser send me some buggy data.

    On the other hand, it is an imperfect design for WWW::Mechanize to die without any error msg, unless it cored. (As the OP pointed out, the bug might be in HTML::Form)

Re: Re: HTTP::Form and invalid radio button values
by cees (Curate) on Dec 19, 2003 at 14:01 UTC
    Somehow I fail to see why you would want to do invalid radio button selection, sounds more like hacking to me. ;-)

    Exactly! I want to make sure that my application can handle an enduser hacking the HTML. When I validate my parameters on the server side I always check to make sure that the user hasn't fudged any data, and I want to add a test to make sure that code is always working correctly. I know it is working right now, but I may break it in the future for all I know. Hence the need for a test.

    - Cees