[Webtest] how to test a form with input type="radio"

Dierk Koenig webtest@lists.canoo.com
Tue, 14 Jan 2003 19:35:07 +0100


Hi Piergiuliano,

the Problem here is the JavaScript, that is currently not supported with
WebTest.

A workaround may be to place a (maybe invisible) submit button or image
inside the form.
This will not do any harm to the application, and allow the test to be
 <setxxx value="bla"/>
 <clickbutton ...>
 <!-- here you deal with the new page -->

(This will also allow users with disabled JS to still use your application)

cheers
Mittie


-----Original Message-----
From: webtest-admin@lists.canoo.com [mailto:webtest-admin@lists.canoo.com]On
Behalf Of Bossi
Sent: Dienstag, 14. Januar 2003 18:55
To: webtest@lists.canoo.com
Subject: [Webtest] how to test a form with input type="radio"


Hello all,
I have a form done this way:
**********************CUT HERE**********************
<FORM action="/xptracking/servlet/NodeDisplayer?display=ProjectHomeNode"
id="userStoryFilterForm" method="POST">
  <TABLE border="0" cellpadding="4" cellspacing="0">
    <TR bgcolor="#A0A0A0">
      <TD width="10"></TD>
      <TD>All</TD>
      <TD><INPUT checked="checked" id="filterTypeAll" name="userStoryFilter"
onclick="form.submit()" type="radio" value="all"></TD>

      <TD width="20"></TD>
      <TD>Not planned</TD>
      <TD><INPUT id="filterTypeNeverPlanned" name="userStoryFilter"
onclick="form.submit()" type="radio" value="never planned"></TD>

      <TD width="20"></TD>
      <TD>Not completed</TD>
      <TD><INPUT id="filterTypeNotCompleted" name="userStoryFilter"
onclick="form.submit()" type="radio" value="not completed"></TD>

      <TD width="20"></TD>
      <TD>Completed</TD>
      <TD><INPUT id="filterTypeCompleted" name="userStoryFilter"
onclick="form.submit()" type="radio" value="completed"></TD><TD
width="10"></TD>
    </TR>
  </TABLE>
</FORM>
**********************CUT HERE**********************
As you can see I have a table with just one row and 4 groups of columns.
Each group has some text, some separators and an INPUT of type="radio".
The idea is that when I click on one of the radio inputs, it should submit
the form, passing the value corresponding to the clicked input.
While the above HTML works perfectly, I was not able to test it using
WebTest. I tried the following:
    <setcheckbox
     stepid="Activate not planned"
     name="userStoryFilter"
     value="never planned" />
but while it generates no error I don't see any action taken, that is I
don't see the effect on the page that I get using the browser and really
clicking on the input. All subsequent tests fail.
I have seen on the syntax reference that clickbutton only supports input
type="submit" or "image", but I don't understand if this the cause: instead
of using setcheckbox I should really using clickbutton, provided that
type="radio" is supported.
What do you think? Am I following the wrong path? Do you see any
alternative?
Thanks a lot,
Giuliano