[Webtest] Accessing the host value

Marc Guillemot Marc Guillemot <mguillemot@yahoo.fr>
Wed, 13 Aug 2008 15:36:26 +0200


Luke.Templin@exeloncorp.com wrote:
> I’m attempting to use the value in the configuration as a property but
> the syntax is wrong.
> 
>  
> 
> Here’s a example  of the test file
> 
> <!DOCTYPE project  SYSTEM "../dtd/Project.dtd" >
> 
> <project name="Test_SomePage_aspx" basedir="." default="wt.testInWork">
> 
>   <property name="name" location="C:/progra~1/webtest" />
> 
>   <import file="${webtest.home}/webtest.xml" />
> 
>   <property name="wt.resultpath" location="../results" />
> 
>   <property file="../includes/login.properties" />
> 
>   <property file="../includes/pageName2.properties" />
> 
>   <target name="wt.testInWork">
> 
>     <webtest name="mytest">
> 
>             &config; <!—want to access the host property from here à
> 
>             &login;
> 
>             <invoke description="Test_SomePage.aspx"
> url="/PageDirectory/SomePage.aspx" />
> 
>             &VerifyNoError;
> 
>             <clickLink htmlId="lnkSendnMarket" />
> 
>             <!—check in the verifyProperty that the host variable is
> what I want but the name is not defined when running the test à
> 
> <verifyProperty description="verify reading host variable"
> name="nMarketFeed.host" text="ksqmststgm01" />
> 
>            
> 
> <property name="SomeFileName"
> value="${webtest.config.host}\generation\Data\rtdisp_${DSTAMP}${TSTAMP}.xml"
> />
> 
>              <verifyProperty description="verify reading host variable"
> name="somePage.host" text="ksqmststgm01" />
> 
>            
> 
>             <loadfile property="nMarketFile" srcFile="${SomeFileName}" />
> 
>  
> 
> The test fails because the host variable name isn’t right. What’s the
> correct syntax to access from the config.host value?

the syntax is correct, concerning the name, it just depends from what
you've used in your &config;

Cheers,
Marc.
-- 
Blog: http://mguillem.wordpress.com