[Webtest] verifyselectfield: hyphen versus default option

Ammann Kuno webtest@lists.canoo.com
Wed, 12 Feb 2003 19:00:46 +0100


hi all
running a tests verifying select fields (combox) is sometime missleading
if you are pre running the test manually over a webbrowser. the problem
is that the webbrowser is showing a option in the select field although
no option was delivered as 'selected' from the server. if nothing is
'selected' the first option is shown as the 'default' selection. i had
this problem with the following select field which was showing a hyphen
as the current option but no option was delivered as 'selected'; my test
step therefore reported:=20
BUILD FAILED Test step verifyselectfield named "bindestrichproblem"
failed with message "Step "bindestrichproblem" (16/17): Select option
<value:- / text:null> is not selected!"

the checked select field was delivered as:
<select name=3D"parent" size=3D"1" ><option =
value=3D"-">-</option><option
value=3D"AFRICA">AFRICA Africa</option><option value=3D"ASIA">ASIA
Asia</option><option value=3D"EU">EU European Union</option><option
value=3D"EUROPE">EUROPE Europe (geo)</option><option =
value=3D"LATAM">LATAM
Latin America</option><option value=3D"ME">ME Middle =
East</option><option
value=3D"NAMERICA">NAMERICA North America</option></select>

we then changed the test step to check value=3D"" and this ended of =
course
with another BUILD FAILED; there is not a option "" selected :-(
finally we needed to check negativ using the not construction to be sure
that no option did get delivered as selected:
 <not stepid=3D"keine gruppe selektiert">			=09
  <verifyselectfield name=3D"parent" value=3D"-"/>
  <verifyselectfield name=3D"parent" value=3D"AFRICA"/>
  ...
</not>

eventually it would be nice to extend the test step description with the
following note:
Note: Please be aware that selectfield do show the first option in the
webbrowser as default option although this option was not delivered as
'selected'. To check this with the verifyselectfield step you need to
check for all option to be not selected using the <not> verify steps
</not> construct.