3 messages in com.canoo.lists.webtestRE: [Webtest] Using a property for a ...
FromSent OnAttachments
Sean Flynn22 Oct 2003 10:03 
Dierk Koenig04 Nov 2003 02:47 
Sean Flynn05 Nov 2003 07:46 
Subject:RE: [Webtest] Using a property for a repeat count
From:Sean Flynn (sean@hotmail.com)
Date:11/05/2003 07:46:03 AM
List:com.canoo.lists.webtest

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" <dier@canoo.com> Reply-To: webt@lists.canoo.com To: <webt@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: webt@lists.canoo.com [mailto:webt@lists.canoo.com]On Behalf Of Sean Flynn Sent: Mittwoch, 22. Oktober 2003 19:04 To: webt@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>