[Webtest] Using a property for a repeat count

Dierk Koenig webtest@lists.canoo.com
Tue, 4 Nov 2003 11:48:06 +0100


Hi Sean,

the repeat count currently cannot be set to a "dynamic property"
as we call it.

I have to admit that I do not understand your test.
The regex
\t<b>\b([0-9]*).*
seems to look for the first bold number, but it will also find
non-number bold (possibly empty) elements with an empty match.
Maybe you are looking for
\t<b>\s*(\d+)

Assume the match is "3".
Then you are verifying the text "3" to appear on the page.
You repeat that verification 3 times.
It will never fail, since you extracted the "3" in the
storeregex step, i.e. the "3" is already asserted to be in the page.
I guess the verifytext should use #{count} to be 0,1,2.

cheers
Mittie

> -----Original Message-----
> From: webtest-admin@lists.canoo.com
> [mailto:webtest-admin@lists.canoo.com]On Behalf Of Sean Flynn
> Sent: Mittwoch, 22. Oktober 2003 19:04
> To: webtest@lists.canoo.com
> Subject: [Webtest] Using a property for a repeat count
>
>
> When I execute the following script I get a
> java.lang.NumberFormatException:
> For input string: "#{ordersToSchedule} error. I have checked that the
> property value is correct. I need to be able to vary the number of
> iterations based upon data I extract from the page. Can I do this with
> WebTest?
>
> <verifytitle stepid="Verify we are at the home page"
> 	text="${home.title}"  />
> <storeregex
> 	stepid="Look for the # of orders to schedule"
> 	text="\t&lt;b&gt;\b([0-9]*).*"
> 	group="1"
> 	property="ordersToSchedule" />
> <repeat count="#{ordersToSchedule}">
> 	<verifytext stepid="Look for # of orders"
> 		text="#{ordersToSchedule}" />
> </repeat>
>
> _________________________________________________________________
> Add MSN 8 Internet Software to your current Internet access and enjoy
> patented spam control and more.  Get two months FREE!
> http://join.msn.com/?page=dept/byoa
>
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>
>