[Webtest] Usage of the Regular Expression

Marc Guillemot webtest@lists.canoo.com
Thu, 14 Apr 2005 09:41:05 +0200


Why do you want to extract the url and then to invoke it? What about clicking the link?

Marc.

Roberto Corda wrote:
> On Wednesday 13 April 2005 17:40, Chintakrindi Meghanath wrote:
> 
>>It should return on matching record, based on which I have to invoke[..]
> 
> 
> I use something like this to test regexp, maybe could be useful.
> 
> *** properties file regexp-test.properties (example)
> parameter.html=bps-regexp-test.html
> parameter.regexp=name="ToHost" value='([0-9]*\-[a-zA-Z\-]*\.[a-z]*\.out)'
> 
> *** xml file (a piece of...)
> <property file="regexp-test.properties" />
> 
> <target name="regexpTest">
>         <echo message="webtest.home is ${webtest.home}"/>
> 	<echo message="parameter.html is ${parameter.html}"/>
> 	<echo message="parameter.regexp is ${parameter.regexp}"/>
>         <testSpec name="regexp a local file">
>             <config
>                 host=""
>                 port="0"
>                 basepath="/"
> 		summary="true"
> 		saveresponse="yes"
> 		resultpath="bps-result"
> 		resultfile="test-regexp-result"
> 		protocol="file" />
>             <steps>
>                 <invoke
>                     	stepid="get local file"
>                     	url="${basedir}/${parameter.html}"/>
> 		<storeRegEx stepid="estrae nome checkBox"
> 			text="${parameter.regexp}"
> 			group="1"
> 			property="checkBoxValue" />
> 		<!-- 
> 
>                      WARN: if regexp returns something invoke step launch an
>                     exception saying that that url doesn't exist. I use that
>                     exception as a log.
>                -->
> 		<invoke
>           		stepid="get Login Page"
>           		url="#{checkBoxValue}" />
>             </steps>
>         </testSpec>
>     </target>
> 
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>