Canoo WebTest? with Mave |
Canoo WebTest with Maven |
build.properties
webtest.home=c:/java/canoo-webtest-1.7 host=localhost port=8082 context=struts-mailreader
build.xml
<project name="MailReaderTest" basedir="." default="main"> <property file="build.properties"/> <taskdef file="${webtest.home}/webtestTaskdefs.properties"> <classpath> <fileset dir="${webtest.home}" includes="**/lib/*.jar"/> </classpath> </taskdef> <target name="main"> <testSpec name="myTest"> <config host="${host}" port="${port}" protocol="http" basepath="${context}" /> <steps> <invoke description="Get Log On Page" url="Logon.do" /> <verifyTitle description="Checking title of Logon page" text="MailReader Demonstration Application - Logon" /> </steps> </testSpec> </target> </project>
E:\java\canoo>ant Buildfile: build.xml Trying to override old definition of task sleep main: [testSpec] INFO (com.canoo.webtest.steps.Step) - Start Step: null "[implict se tup step]" (1/4) [testSpec] INFO (com.canoo.webtest.steps.Setup) - Surfing with browser Mozilla /4.0 (compatible; MSIE 6.0b; Windows 98) [testSpec] INFO (com.canoo.webtest.steps.Step) - Start Step: invoke "Get Log O n Page" (2/4) [testSpec] INFO (com.canoo.webtest.steps.request.AbstractTargetAction) - -> go toTarget by URL: Logon.do [testSpec] INFO (com.canoo.webtest.steps.request.TargetHelper) - getting respo nse for url: http://localhost:8082/struts-mailreader/Logon.do [testSpec] INFO (com.canoo.webtest.engine.Context) - Current form set to none [testSpec] INFO (com.canoo.webtest.steps.Step) - Start Step: verifyTitle "Chec king title of Logon page" (3/4) [testSpec] INFO (com.canoo.webtest.steps.Step) - Start Step: null "[implicit t ear down step]" (4/4) BUILD SUCCESSFUL Total time: 3 seconds E:\java\canoo>
build.properties (same as above)
build.xml
<project name="MailreaderTest" basedir="." default="main"> <property file="build.properties"/> <taskdef file="${webtest.home}/webtestTaskdefs.properties"> <classpath> <fileset dir="${webtest.home}" includes="**/lib/*.jar"/> </classpath> </taskdef> <target name="main"> <testSpec name="myTest"> <config host="${host}" port="${port}" protocol="http" basepath="${context}" /> <steps> <!-- This test loads the home page of the struts mailreader webapp, clicks on the "Log on" link, clicks on the "Mailreader home" link, then clicks on the "Register" link. If any of the page titles does not match, the build will fail. --> <invoke description="Get Home Page" url="" /> <verifyTitle description="Checking title of Home page" text="MailReader Demonstration Application" /> <clickLink href="Logon"/> <verifyTitle description="Checking title of Log on page" text="MailReader Demonstration Application - Logon" /> <clickLink href="Welcome"/> <verifyTitle description="Checking title of Home page" text="MailReader Demonstration Application" /> <clickLink href="EditRegistration"/> <verifyTitle description="Checking title of Registration page" text="Register for the MailReader Demonstration Application" /> </steps> </testSpec> </target> </project>
E:\java\canoo>ant Buildfile: build.xml Trying to override old definition of task sleep main: [testSpec] INFO (com.canoo.webtest.steps.Step) - Start Step: null "[implict se tup step]" (1/10) [testSpec] INFO (com.canoo.webtest.steps.Setup) - Surfing with browser Mozilla /4.0 (compatible; MSIE 6.0b; Windows 98) [testSpec] INFO (com.canoo.webtest.steps.Step) - Start Step: invoke "Get Home Page" (2/10) [testSpec] INFO (com.canoo.webtest.steps.request.AbstractTargetAction) - -> go toTarget by URL: [testSpec] INFO (com.canoo.webtest.steps.request.TargetHelper) - getting respo nse for url: http://localhost:8082/struts-mailreader [testSpec] INFO (org.apache.commons.httpclient.HttpMethodDirector) - Redirect requested but followRedirects is disabled [testSpec] INFO (org.apache.commons.httpclient.HttpMethodDirector) - Redirect requested but followRedirects is disabled [testSpec] INFO (com.canoo.webtest.engine.Context) - Current form set to none [testSpec] INFO (com.canoo.webtest.steps.Step) - Start Step: verifyTitle "Chec king title of Home page" (3/10) [testSpec] INFO (com.canoo.webtest.steps.Step) - Start Step: clickLink "<unkno wn>" (4/10) [testSpec] INFO (com.canoo.webtest.steps.request.AbstractTargetAction) - -> go toTarget by clickLink [testSpec] INFO (com.canoo.webtest.engine.Context) - Current form set to none [testSpec] INFO (com.canoo.webtest.steps.Step) - Start Step: verifyTitle "Chec king title of Log on page" (5/10) [testSpec] INFO (com.canoo.webtest.steps.Step) - Start Step: clickLink "<unkno wn>" (6/10) [testSpec] INFO (com.canoo.webtest.steps.request.AbstractTargetAction) - -> go toTarget by clickLink [testSpec] INFO (com.canoo.webtest.engine.Context) - Current form set to none [testSpec] INFO (com.canoo.webtest.steps.Step) - Start Step: verifyTitle "Chec king title of Home page" (7/10) [testSpec] INFO (com.canoo.webtest.steps.Step) - Start Step: clickLink "<unkno wn>" (8/10) [testSpec] INFO (com.canoo.webtest.steps.request.AbstractTargetAction) - -> go toTarget by clickLink [testSpec] INFO (com.canoo.webtest.engine.Context) - Current form set to none [testSpec] INFO (com.canoo.webtest.steps.Step) - Start Step: verifyTitle "Chec king title of Registration page" (9/10) [testSpec] INFO (com.canoo.webtest.steps.Step) - Start Step: null "[implicit t ear down step]" (10/10) BUILD SUCCESSFUL Total time: 4 seconds E:\java\canoo>
In the project directory, project.properties:
maven.webtest.config.port=8082(It defaults to localhost:80)