[Webtest] minor problem with <clickbutton>

Dierk Koenig webtest@lists.canoo.com
Thu, 4 Sep 2003 18:56:23 +0200


Hi Stephen,

thanx for your excellent post.

I addressed your issue with build 365.

The solution started with making the selftest.xml exposing the erroneous
behaviour.
Then thinking through the problem I went for a different route that puts the
logik not in the clicklink execution itself, but in the locator calls.
Things a really difficult with all the combinations of forms and indexes.
I think the documentation also needs an update on this issue.

Also I recognized that the current reporting style does not reveal the
locators :-(.
In case of errors, WT now reports as many information as it can find about
the parameter that causes trouble, and the form it resides in.

hope that helps and happy testing
Mittie

P.S.
httpunit upgraded to 1.5.4
BTW: the above bug was introduced when an upgrade of httpunit changed
behaviour of button references not being unique anymore.
dom4j upgraded to 1.4
(the old version was buggy e.g. with the "translate" function)


> -----Original Message-----
> From: webtest-admin@lists.canoo.com
> [mailto:webtest-admin@lists.canoo.com]On Behalf Of
> stephen_peterson@agilent.com
> Sent: Mittwoch, 3. September 2003 23:56
> To: webtest@lists.canoo.com
> Subject: [Webtest] minor problem with <clickbutton>
>
>
> Hi,
>
> I'm having a minor problem with <clickbutton> when
> there are multiple forms on the page with the same
> button name.  Although I specify <form> or <index>,
> I get an error indicating that the target form does
> not have the specified input.  I'm using build 364.
>
> I get the following error:
>
> com.canoo.webtest.engine.StepFailedException: No such parameter
> in form: input2, Step: ClickButton at
> file:C:/views/srpOasis1.2J/Oasis/was/tools/canooPlus/examples/test
> s.xml:225: with (stepId="submit form", name="submit",
> stepType="clickbutton")
>
> HTML snippet:
>
> <form name="form1" method="post" action="example2.html">
> <input name="input1" type="text" size="10" value="">
> <input name="submit" type="submit" value="submit">
> </form>
> <form name="form2" method="post" action="example2.html">
> <input name="input2" type="text" size="10" value="">
> <input name="submit" type="submit" value="submit">
> </form>
>
> WebTest snippet:
>
> <steps>
> <invoke url="example2.html"/>
> <setinputfield stepid="set input value" name="input2" value="xyzzy"/>
> <clickbutton stepid="submit form" name="submit">
>   <form name="form2"/>
> </clickbutton>
> </steps>
>
> If I modify the HTML to eliminate the duplicate names
> so I don't need the locators, it works fine -- but this
> is really not an option.
>
> It looks like ClickButton.findFormFor(...) does not
> use the form/index locators.  The HTML/test above works
> When I extend ClickButton and override findFormFor()
> with:
>
> protected WebForm findFormFor( WebResponse resp, Button button )
> throws SAXException
> {
>   if ( formLocator != null ) {
>     try {
>       // cachedContext is a reference to the Context passed in to
> doExecute()
>       return formLocator.locateForm( cachedContext );
>     }
>     catch ( Exception e ) {
>       // error ... fall in to parent functionality
>     }
>   }
>   if ( indexLocator != null ) {
>     // findFormsFor() is a utility to find all forms that contain 'button'
>     return ( WebForm )indexLocator.locateItem( findFormsFor(
> resp, button ) );
>   }
>   return super.findFormFor( resp, button );
> }
>
> It would also be very nice to have the error message include
> the form name.
>
> By the way, I've been using an older version of WebTest
> (build 234) for the past year to monitor/test development
> on a web-site, and it has been invaluable!  Thanks for all
> the good work.
>
> Regards,
>
> Stephen
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>
>