[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"><FORM action="/xptracking/servlet/NodeDisplayer?display=ProjectHomeNode"
id="userStoryFilterForm" method="POST"></font></tt>
<br><tt><font color="#3333FF"> <TABLE border="0" cellpadding="4"
cellspacing="0"></font></tt>
<br><tt><font color="#3333FF"> <TR bgcolor="#A0A0A0"></font></tt>
<br><tt><font color="#3333FF"> <TD width="10"></TD></font></tt>
<br><tt><font color="#3333FF"> <TD>All</TD></font></tt>
<br><tt><font color="#3333FF"> <TD><INPUT
checked="checked" id="filterTypeAll" name="userStoryFilter" onclick="form.submit()"
type="radio" value="all"></TD></font></tt>
<br><tt><font color="#3333FF"> </font></tt>
<br><tt><font color="#3333FF"> <TD width="20"></TD></font></tt>
<br><tt><font color="#3333FF"> <TD>Not
planned</TD></font></tt>
<br><tt><font color="#3333FF"> <TD><INPUT
id="filterTypeNeverPlanned" name="userStoryFilter" onclick="form.submit()"
type="radio" value="never planned"></TD></font></tt>
<br><tt><font color="#3333FF"> </font></tt>
<br><tt><font color="#3333FF"> <TD width="20"></TD></font></tt>
<br><tt><font color="#3333FF"> <TD>Not
completed</TD></font></tt>
<br><tt><font color="#3333FF"> <TD><INPUT
id="filterTypeNotCompleted" name="userStoryFilter" onclick="form.submit()"
type="radio" value="not completed"></TD></font></tt>
<br><tt><font color="#3333FF"> </font></tt>
<br><tt><font color="#3333FF"> <TD width="20"></TD></font></tt>
<br><tt><font color="#3333FF"> <TD>Completed</TD></font></tt>
<br><tt><font color="#3333FF"> <TD><INPUT
id="filterTypeCompleted" name="userStoryFilter" onclick="form.submit()"
type="radio" value="completed"></TD><TD width="10"></TD></font></tt>
<br><tt><font color="#3333FF"> </TR></font></tt>
<br><tt><font color="#3333FF"> </TABLE></font></tt>
<br><tt><font color="#3333FF"></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> <setcheckbox
<br> stepid="Activate not planned"
<br> name="userStoryFilter"
<br> 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> </html>
--------------CB0F7F1D711B1E0EDCE28F66--