[Webtest] Logging in and then running tests
Aatish Arora
webtest@lists.canoo.com
Thu, 20 Feb 2003 08:35:00 -0800 (PST)
Hi Mat,
Heres what you can do -
You can keep the common steps in a file - say
login.xml
and can include this file like the example given on:
http://webtest.canoo.com/webtest/manual/samples.html
Its called "Including Files"
check it out,
best of luck,
Aatish
--- Matt Raible <matt@raibledesigns.com> wrote:
> I'm using webtest for the following two tests: login
> and viewCM. I'd like to
> somehow make viewCM depend on login without copying
> the actual steps from
> login into my testcase. Is this possible?
> Basically, all my tests will have
> to login first to do something - what's the easiest
> way without duplicating
> lines of XML?
>
> Thanks,
>
> Matt
>
> <target name="login"
> description="Runs login test and verifies
> Main Menu's Title">
> <canoo name="tomcat-login">
> <config host="${tomcat.server}"
> port="${tomcat.port}"
> protocol="http"
> basepath="${webapp.name}" verbose="true"
> resultpath="${test.dir}/data"
> resultfile="web-tests-
> result.xml" summary="true"
> saveresponse="true"/>
> <steps>
> <invoke stepid="get Login Page"
> url="/"/>
> <verifytitle stepid="we should see
> the login title"
> text="CCT - Login"/>
> <setinputfield stepid="set user
> name" name="j_username"
> value="tomcat@cable.comcast.com"/>
> <setinputfield stepid="set password"
> name="j_password"
> value="tomcat"/>
> <clickbutton label="Login"
> stepid="Click the submit button"/>
> <verifytitle text="CCT - Main Menu"
> stepid="Home Page follows
> if login ok"/>
> </steps>
> </canoo>
> <loadfile property="web-tests.result"
>
> srcFile="${test.dir}/data/web-tests-result.xml"/>
> <echo>${web-tests.result}</echo>
> </target>
>
> <target name="viewCM"
> description="Diplays the current channel map
> page">
> <canoo name="currentChannelMap">
> <config host="${tomcat.server}"
> port="${tomcat.port}"
> protocol="http"
> basepath="${webapp.name}" verbose="true"
> resultpath="${test.dir}/data"
> resultfile="web-tests-
> result.xml" summary="true"
> saveresponse="true"/>
> <steps>
> <!--============================================
> DUPLICATE DATA BEGINS HERE -
> SAME AS STEPS ABOVE ===============-->
> <invoke stepid="get Login Page"
> url="/"/>
> <verifytitle stepid="we should see
> the login title"
> text="CCT - Login"/>
> <setinputfield stepid="set user
> name" name="j_username"
> value="tomcat@cable.comcast.com"/>
> <setinputfield stepid="set password"
> name="j_password"
> value="tomcat"/>
> <clickbutton label="Login"
> stepid="Click the submit button"/>
> <verifytitle text="CCT - Main Menu"
> stepid="Home Page follows
> if login ok"/>
> <!--============================== END OF DUPLICATE
> STEPS
> =======================-->
> <invoke stepid="click on menu to
> view current CM"
>
url="/do/editChannelMap?action=view&headendId=71715"/>
> <verifytitle stepid="we should see
> the view channel map
> title" text="CCT - Current Channel Map"/>
> </steps>
> </canoo>
> <loadfile property="web-tests.result"
>
> srcFile="${test.dir}/data/web-tests-result.xml"/>
> <echo>${web-tests.result}</echo>
> </target>
>
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/