I have defined my user test values in a test-data.properties:

it_user1.username=_it_user_1
it_user1.password=user
it_user2.username=_it_user_2
it_user2.password=user

In my web-tests.xml:

<project basedir="." default="run-all-tests">
    <taskdef resource="webtestTaskdefs.properties" />
    &testMacros;

    <property file="test-data.properties"/>

    <!-- runs all targets -->
    <target name="run-all-tests"
        depends="BillingInfoTests,PricingPlanTests"
        description="Call and executes all test cases (targets)"/>

...
    <target name="AddBillingInfo" description="Adds a new BillingInfo">
        <webtest name="addBillingInfo">
            &config;
            <steps>
                <loginIssuer username="${it_user1.username}"
password="${it_user1.password}"/>
                <clickLink label="${menu.account}"/>
...


2010/11/11 Iain_10 <[email protected]>

>
>
> Can I define the macro in my build.xml file?
>
> Josep,
> In your example where are the actual values for username and password
> defined?
>
> thanks!
>
>
> Indeed, as Murat sugests, I use a macro:
>
>
> <macrodef name="loginIssuer" description="perform a login for the provided
> user and password">
>    <attribute name="username"/>
>    <attribute name="password"/>
>    <sequential>
>        <invoke description="get Login Page" url="/"/>
>        <verifytitle description="we should see the login title"
> text=".*${login.title}.*" regex="true"/>
>        <setinputfield description="set user name" name="j_username"
> value="@{username}"/>
>        <setinputfield description="set password" name="j_password"
> value="@{password}"/>
>        <clickbutton label="${button.login}" description="Click the submit
> button"/>
>        <!--
>        <verifytitle description="Home Page follows if login ok"
> text=".*${userDocumentList.title}.*" regex="true"/>
>        -->
>    </sequential>
> </macrodef>
>
> Josep
>
>
>
> --
> View this message in context:
> http://old.nabble.com/Help-with-log-in-test-cases-tp30189200p30190245.html
> Sent from the WebTest mailing list archive at Nabble.com.
>
> _______________________________________________
> WebTest mailing list
> [email protected]
> http://lists.canoo.com/mailman/listinfo/webtest
>

Reply via email to