Hi Shawn,

I'm pretty new to WebTest, but maybe the way I handle creating a unque
string might be some help:

<groovy description="get a unique string for username based on datetimestamp">
        today = new Date()
        step.setWebtestProperty ('DateTimeString', today.toString()[4..6]
+ today.toString()[8..9] + today.toString()[11..12] +
today.toString()[14..15] + today.toString()[17..18] +
today.toString()[25..28])
</groovy>

<property name="username" value="#{DateTimeString}" />

then I proceed to register a new user using this string:

<setInputField       name="username"                       value="${username}"/>

so I guess I'm suggesting you use groovy to set a dynamic property,
which you then access using # rather than $. The dynamic property can
then be updated by further calls - one per "repeat" loop I guess.

I'm not quite sure how you would do the repeat - I think the easiest
way would be to do this whole part of your test in groovy code rather
than try to do this sort of logic in an Ant script. I think you'll be
able to find some examples of using Groovy rather than Ant to drive a
test, but I have not tried this myself yet. I will however need to do
a similar thing myself, e.g. I'd like to be able to test the full
range of allowed and disallowed inputs to a standard web field i.e.
min length, max length, allowed and disallowed characters, range if
numeric; without having to "hard code" all of these variations in an
ant script.

regards,
        John

On 1/2/07, Shawn Bradley <[EMAIL PROTECTED]> 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


_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to