You should define all your macros within the definitions folder and they will automagically be loaded up by webtest. Webtest looks in that directory to create definitions.xml which it then loads in build.xml. This means any xml files you place in the definitions folder will be executed prior to any webtest executions. Do note that running webtest generates the definitions.xml file. You will need to run webtest twice for new macros to be usable. Other than that, you don't need to do anything special to gain access to the macros you write.
Cheers, John Spann Software Engineer Citrix Online | 6500 Hollister Avenue | Goleta, CA 93117 T: +1 805 690 3489 | M: +1 805 729 0008 [email protected]<x-msg://29/[email protected]> http://www.citrixonline.com [cid:[email protected]] Access Your PC From Anywhere: www.gotomypc.com<http://www.gotomypc.com/> Online Meetings Made Easy: www.gotomeeting.com<http://www.gotomeeting.com/> Remote Support Made Easy: www.gotoassist.com<http://www.gotoassist.com/> Webinars Made Easy: www.gotowebinar.com<http://www.gotowebinar.com/> On Nov 11, 2010, at 7:36 AM, Josep García wrote: 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]<mailto:[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<http://Nabble.com>. _______________________________________________ WebTest mailing list [email protected]<mailto:[email protected]> http://lists.canoo.com/mailman/listinfo/webtest
<<inline: image001.png>>

