[Webtest] Using a property for a repeat count

Sean Flynn webtest@lists.canoo.com
Wed, 05 Nov 2003 15:46:25 +0000


Hi Mitte,

Thanks for responding. I'm new with Regex so please excuse my hack code. As 
part of a test I needed to navigate to a particular page a variable number 
of times as defined by a value on a page. The test in loop currently does a 
verifytext but I would replace this with the appropriate navigation once I 
found a way to loop a variable number of times. I know this goes against the 
goal of statically defined tests but it sure would be nice to have. My 
opinion would be to allow programmatic flow and simply warn users about its 
usage.

Thanks,
Sean

----Original Message Follows----
From: "Dierk Koenig" <dierk.koenig@canoo.com>
Reply-To: webtest@lists.canoo.com
To: <webtest@lists.canoo.com>
Subject: RE: [Webtest] Using a property for a repeat count
Date: 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
 >
 >


_______________________________________________
WebTest mailing list
WebTest@lists.canoo.com
http://lists.canoo.com/mailman/listinfo/webtest

_________________________________________________________________
Compare high-speed Internet plans, starting at $26.95.  
https://broadband.msn.com (Prices may vary by service area.)