[Webtest] Why are setXxxx "delayed"?

Marc Guillemot webtest@lists.canoo.com
Wed, 05 Nov 2003 17:42:56 +0100


Hi Dierk,

> the main issue here is locating the correct inputfield.
> 
> The current strategy does not have to deal at all with issues that
> arise when more than one inputfield with the same name appears multiple
> times on the page/in the same form/in multiple forms/etc.
> An immediate setting would need to deal with it, forcing the tester
> to give more information.

I think that the html id attribute have to be used in the worst case to have an 
exact location of an input field.
Ex:
for
<input type="checkbox" name="myCheckBox" id="myCheckBox1">
<input type="checkbox" name="myCheckBox" id="myCheckBox2">

we could uniquely identified the right checkbox with:
<setcheckbox htmlid="myCheckBox2" checked="true"/>

When no htmlid is specified but just a name, we could define rules like
- look for an element with the given name in the last "used" form (ie the form 
in which a setXxxx has been made previously)
- if no element is found in this form, take the first form of the document 
containing an element with the specified name

A form could be defined as the "current" one with an additional step BEFORE 
doing something on this form. Indeed I think that it is more natural to specify 
the form when it's ambiguous before setting anything on it, and not just before 
submitting it.
An other advantage would be for the javascript support: some javascript code may 
be interested in the values in a form even if the form doesn't get submitted.

 > ...
> P.S. As always, backward compatibility is a mandatory.

If you're ok with the previous solution, we could add it without removing the 
current steps, giving users the possibility to use the "new" steps rather than 
the "old" ones.

I think that this question is not only related to these steps, but more general: 
how can we evolve from one solution to an other with backward compatibility.

Marc.