[Webtest] Re: Simple Test - visiting a web page

Marc Guillemot webtest@lists.canoo.com
Mon, 17 May 2004 22:02:37 +0200


Webtest store the received responses, which in your case contains a refresh and this page is not stored.

Marc.

CF Wong wrote:
> Lezoul, here is result of your sample test for http.
>  
> The test is working as per command prompt window. However, when I try to 
> open the generated response file with IE, it displays an error. 
>  
> I would appreciate your help or from other forum members. Thanks.
>  
> Best Regards,
> CF
>  
> ------------ sample script to visit a web page  test.xml -----------
> <project name="testYcebt.xml" basedir="." default="checkWebTest">
>  
> <property name="base.dir" value="${basedir}"/>
> <property name="webtest.home" value="${base.dir}/../.."/>
>  
> <taskdef file="${webtest.home}/webtestTaskdefs.properties">
>    <classpath>
>       <fileset dir="${webtest.home}" includes="**/lib/*.jar"/>
>    </classpath>
> </taskdef>
>  
> <target name="checkWebTest">
>    <echo message="base dir is ${basedir}"/>
>    <testSpec name="check calling and parsing a local file">
>       <config
>          host="webtest.canoo.com"
>          port="80"
>          basepath="/"
>          saveresponse="true"
>          protocol="http" />
>       <steps>
>          <invoke
>             stepid="get local file"
>             url="webtest"/>
>          <verifytitle
>             stepid="check the title is parsed correctly"
>             text="Canoo WebTest Homepage" />
>       </steps>
>    </testSpec>
> </target>
> </project>
>  
> ---------- message from command prompt ------------
> D:\WebTest\doc\samples>ant -v -buildfile test.xml
> Apache Ant version 1.5.4 compiled on August 12 2003
> Buildfile: test.xml
> Detected Java version: 1.4 in: D:\Sun\AppServer\jdk\jre
> Detected OS: Windows XP
> parsing buildfile test.xml with URI = file:D:/WebTest/doc/samples/test.xml
> Project base dir set to: D:\WebTest\doc\samples
>   [taskdef] Loading definitions from file 
> D:\WebTest\webtestTaskdefs.properties
> Build sequence for target `checkWebTest' is [checkWebTest]
> Complete build sequence is [checkWebTest]
>  
> checkWebTest:
>      [echo] base dir is D:\WebTest\doc\samples
>  
> BUILD SUCCESSFUL
> Total time: 4 seconds
>  
> ------------------ browser error message --------------
> The file lastResponse1084805112250.html was generated.
> On browsing the above file, an Alert pops up:
> The file /D:/WebTest/doc/samples/manual/WebTestHome.html cannot be 
> found. Please check the location and try again.
>  
> ------------  lastResponse1084805112250.html source -----------
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD><TITLE>Canoo WebTest Homepage</TITLE>
> <META http-equiv="Refresh" content="0;URL=manual/WebTestHome.html">
>  
> </HEAD>
> <BODY>
>  
> </BODY></HTML>