[Webtest] Testing with lists of input data

Marc Guillemot Marc Guillemot <mguillemot@yahoo.fr>
Tue, 02 Jan 2007 09:10:19 +0100


Hi Shawn,

if I correctly understand, you have properties like

categ.name.0=first categ
categ.name.1=second categ
...

and want to iterate over this categs. Right?

The repeat loop provides the counter variable but nested properties 
evaluation like ${categ.name.#{counter}} is currently not available. The 
workaround is to externalize the body of your repeat loop in a macro:

<macrodef name="myRepeatBody">
   <attribute name="index" description="the current loop index"/>
   <sequentials>
     <setInputField forLabel="Category" value="${categ.name.@{index}}"/>
     ...
   </sequentials>
</macrodef>

and
<webtest ...>
   ...
   <repeat count="...">
     <myRepeatBody index="#{counter}"/>
   </repeat>
</webtest>

Happy Testing,
Marc.

Shawn Bradley wrote:
> I am fairly new to WebTest, but so far, I've been able to accomplish 
> just about everything I need to.  However, I am stuck at this particular 
> requirement.
> 
>  
> 
> Our app builds expense reports, and each expense entry references an 
> expense category.  I am writing tests to exercise the expense category 
> maintenance portion of the app.  What I want to do is create a property 
> file that contains the parameters for a dozen or so expense categories.  
> I then need my WebTest case to create each of these categories in a 
> loop, using <repeat> or some other construct.  I DON'T want to have to 
> create the same XML instructions a dozen or more times to construct the 
> categories in a linear fashion.
> 
>  
> 
> I have spent hours digging through the newsgroup and mailing list 
> archives, and I cannot find an example similar to what I am trying to 
> do.  This seems like such a common task to me - surely someone else has 
> had a similar requirement.  How do I accomplish this?
> 
>  
> 
> Thanks,
> 
>  
> 
>  
> 
> Shawn Bradley
> 
> President, Sunergeo Systems, Inc.
> 
> www.sunergeosystems.com
> 
>  
>