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

Piergiuliano Bossi webtest@lists.canoo.com
Tue, 14 Jan 2003 18:54:56 +0100


--------------CB0F7F1D711B1E0EDCE28F66
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

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


--------------CB0F7F1D711B1E0EDCE28F66
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hello all,
<p>I have a form done this way:
<p>**********************CUT HERE**********************
<br><tt><font color="#3333FF">&lt;FORM action="/xptracking/servlet/NodeDisplayer?display=ProjectHomeNode"
id="userStoryFilterForm" method="POST"></font></tt>
<br><tt><font color="#3333FF">&nbsp; &lt;TABLE border="0" cellpadding="4"
cellspacing="0"></font></tt>
<br><tt><font color="#3333FF">&nbsp;&nbsp;&nbsp; &lt;TR bgcolor="#A0A0A0"></font></tt>
<br><tt><font color="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;TD width="10">&lt;/TD></font></tt>
<br><tt><font color="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;TD>All&lt;/TD></font></tt>
<br><tt><font color="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;TD>&lt;INPUT
checked="checked" id="filterTypeAll" name="userStoryFilter" onclick="form.submit()"
type="radio" value="all">&lt;/TD></font></tt>
<br><tt><font color="#3333FF">&nbsp;</font></tt>
<br><tt><font color="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;TD width="20">&lt;/TD></font></tt>
<br><tt><font color="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;TD>Not
planned&lt;/TD></font></tt>
<br><tt><font color="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;TD>&lt;INPUT
id="filterTypeNeverPlanned" name="userStoryFilter" onclick="form.submit()"
type="radio" value="never planned">&lt;/TD></font></tt>
<br><tt><font color="#3333FF">&nbsp;</font></tt>
<br><tt><font color="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;TD width="20">&lt;/TD></font></tt>
<br><tt><font color="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;TD>Not
completed&lt;/TD></font></tt>
<br><tt><font color="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;TD>&lt;INPUT
id="filterTypeNotCompleted" name="userStoryFilter" onclick="form.submit()"
type="radio" value="not completed">&lt;/TD></font></tt>
<br><tt><font color="#3333FF">&nbsp;</font></tt>
<br><tt><font color="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;TD width="20">&lt;/TD></font></tt>
<br><tt><font color="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;TD>Completed&lt;/TD></font></tt>
<br><tt><font color="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;TD>&lt;INPUT
id="filterTypeCompleted" name="userStoryFilter" onclick="form.submit()"
type="radio" value="completed">&lt;/TD>&lt;TD width="10">&lt;/TD></font></tt>
<br><tt><font color="#3333FF">&nbsp;&nbsp;&nbsp; &lt;/TR></font></tt>
<br><tt><font color="#3333FF">&nbsp; &lt;/TABLE></font></tt>
<br><tt><font color="#3333FF">&lt;/FORM></font></tt>
<br>**********************CUT HERE**********************
<p>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".
<br>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.
<p>While the above HTML works perfectly, I was not able to test it using
WebTest. I tried the following:
<p>&nbsp;&nbsp;&nbsp; &lt;setcheckbox
<br>&nbsp;&nbsp;&nbsp;&nbsp; stepid="Activate not planned"
<br>&nbsp;&nbsp;&nbsp;&nbsp; name="userStoryFilter"
<br>&nbsp;&nbsp;&nbsp;&nbsp; value="never planned" />
<p>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.
<p>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.
<p>What do you think? Am I following the wrong path? Do you see any alternative?
<br>Thanks a lot,
<br>Giuliano
<br>&nbsp;</html>

--------------CB0F7F1D711B1E0EDCE28F66--