[Webtest] Newbie question

Howard Bartel webtest@lists.canoo.com
Thu, 1 Jun 2006 10:22:02 -0700


Hi,

I'm trying to get Canoo up and running to where it can interact with our web
system.
I am getting an exception and do not know how to fix it.
I wonder if it is because it is assuming IE for the browser?  IE is not
available on my system; I use Firefox (on a linux/lynxOS system).

Thanks,
Howard

My web-test looks like this:

 <project name="SimpleTest" basedir="." default="main">

   <taskdef file="/home/hbartel/Canoo/build/webtestTaskdefs.properties">
      <classpath>
         <fileset dir="/home/hbartel/Canoo/build" includes="**/lib/*.jar"/>
      </classpath>
   </taskdef>

   <target name="main">
      <testSpec name="myTest">
         <config
            host="10.0.0.118"
            port="80"
            protocol="http"
            basepath=""
            saveresponse="true"
            resultpath="/home/hbartel/webTests/result" />
         <steps>
            <invoke
               stepid="get Login Page"
               url="ms.cgi" />
            <verifytitle
               stepid="we should see the login title"
               text="Administrator Login - Mozilla Firefox" />
         </steps>
      </testSpec>
   </target>
</project>

The stack trace:

[134]% ant -buildfile SimpleTest.xml
Buildfile: SimpleTest.xml
Trying to override old definition of task sleep

main:
 [testSpec]  INFO (Step.java:233) - Start Step: null "[implict setup step]"
(1/4)
 [testSpec]  INFO (Step.java:233) - Start Step: invoke "get Login Page"
(2/4)
 [testSpec]  INFO (Target.java:144) - -> gotoTarget(by url):
http://10.0.0.118:80/ms.cgi
 [testSpec] ERROR (Step.java:370) - Cannot handle unexpected exception in
step InvokePage at /home/hbartel/webTests/SimpleTest.xml:21:  with
(stepId="get Login Page", url="ms.cgi", stepType="invoke")
 [testSpec] java.io.IOException
 [testSpec]     at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection
.java:643)
 [testSpec]     at
java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:304)
 [testSpec]     at
com.meterware.httpunit.HttpWebResponse.readResponseHeader(HttpWebResponse.ja
va:162)
 [testSpec]     at
com.meterware.httpunit.HttpWebResponse.readHeaders(HttpWebResponse.java:200)
 [testSpec]     at
com.meterware.httpunit.HttpWebResponse.<init>(HttpWebResponse.java:56)
 [testSpec]     at
com.meterware.httpunit.HttpWebResponse.<init>(HttpWebResponse.java:67)
 [testSpec]     at
com.meterware.httpunit.WebConversation.newResponse(WebConversation.java:76)
 [testSpec]     at
com.meterware.httpunit.WebWindow.getResource(WebWindow.java:164)
 [testSpec]     at
com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:128)
 [testSpec]     at
com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:121)
 [testSpec]     at
com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:102)
 [testSpec]     at
com.meterware.httpunit.WebClient.getResponse(WebClient.java:87)
 [testSpec]     at
com.canoo.webtest.steps.request.Target.getResponse(Target.java:158)
 [testSpec]     at
com.canoo.webtest.steps.request.Target$1.call(Target.java:145)
 [testSpec]     at
com.canoo.webtest.steps.request.Target.protectedGoto(Target.java:104)
 [testSpec]     at
com.canoo.webtest.steps.request.Target.gotoTarget(Target.java:142)
 [testSpec]     at
com.canoo.webtest.steps.request.InvokePage.doExecute(InvokePage.java:37)
 [testSpec]     at com.canoo.webtest.steps.Step.execute(Step.java:118)
 [testSpec]     at
com.canoo.webtest.engine.Engine.executeSteps(Engine.java:26)
 [testSpec]     at
com.canoo.webtest.ant.TestSpecificationTask.execute(TestSpecificationTask.ja
va:68)
 [testSpec]     at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
 [testSpec]     at org.apache.tools.ant.Task.perform(Task.java:364)
 [testSpec]     at org.apache.tools.ant.Target.execute(Target.java:341)
 [testSpec]     at org.apache.tools.ant.Target.performTasks(Target.java:369)
 [testSpec]     at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
 [testSpec]     at
org.apache.tools.ant.Project.executeTarget(Project.java:1185)
 [testSpec]     at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.j
ava:40)
 [testSpec]     at
org.apache.tools.ant.Project.executeTargets(Project.java:1068)
 [testSpec]     at org.apache.tools.ant.Main.runBuild(Main.java:668)
 [testSpec]     at org.apache.tools.ant.Main.startAnt(Main.java:187)
 [testSpec]     at
org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
 [testSpec]     at
org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
 [testSpec] Caused by: java.net.ConnectException: Connection timed out
 [testSpec]     at java.net.PlainSocketImpl.socketConnect(Native Method)
 [testSpec]     at
java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:331)
 [testSpec]     at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:196)
 [testSpec]     at
java.net.PlainSocketImpl.connect(PlainSocketImpl.java:183)
 [testSpec]     at java.net.Socket.connect(Socket.java:478)
 [testSpec]     at java.net.Socket.connect(Socket.java:428)
 [testSpec]     at sun.net.NetworkClient.doConnect(NetworkClient.java:158)
 [testSpec]     at
sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
 [testSpec]     at
sun.net.www.http.HttpClient.openServer(HttpClient.java:646)
 [testSpec]     at sun.net.www.http.HttpClient.<init>(HttpClient.java:336)
 [testSpec]     at sun.net.www.http.HttpClient.<init>(HttpClient.java:297)
 [testSpec]     at sun.net.www.http.HttpClient.New(HttpClient.java:369)
 [testSpec]     at sun.net.www.http.HttpClient.New(HttpClient.java:350)
 [testSpec]     at sun.net.www.http.HttpClient.New(HttpClient.java:345)
 [testSpec]     at
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.j
ava:562)
 [testSpec]     at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:5
39)
 [testSpec]     at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection
.java:667)
 [testSpec]     at
sun.net.www.protocol.http.HttpURLConnection.getHeaderFieldKey(HttpURLConnect
ion.java:1546)
 [testSpec]     at
com.meterware.httpunit.HttpWebResponse.loadHeaders(HttpWebResponse.java:216)
 [testSpec]     at
com.meterware.httpunit.HttpWebResponse.readHeaders(HttpWebResponse.java:198)
 [testSpec]     ... 28 more

BUILD FAILED
/home/hbartel/webTests/SimpleTest.xml:10: Test failed.
Exception raised: com.canoo.webtest.engine.StepExecutionException:
Unexpected exception caught: java.io.IOException, Step: InvokePage at
/home/hbartel/webTests/SimpleTest.xml:21:  with (stepId="get Login Page",
url="ms.cgi",
stepType="invoke")com.canoo.webtest.engine.StepExecutionException:
Unexpected exception caught: java.io.IOException, Step: InvokePage at
/home/hbartel/webTests/SimpleTest.xml:21:  with (stepId="get Login Page",
url="ms.cgi", stepType="invoke")
        at
com.canoo.webtest.steps.Step.handleUnexpectedException(Step.java:371)
        at
com.canoo.webtest.steps.request.Target.protectedGoto(Target.java:113)
        at
com.canoo.webtest.steps.request.Target.gotoTarget(Target.java:142)
        at
com.canoo.webtest.steps.request.InvokePage.doExecute(InvokePage.java:37)
        at com.canoo.webtest.steps.Step.execute(Step.java:118)
        at com.canoo.webtest.engine.Engine.executeSteps(Engine.java:26)
        at
com.canoo.webtest.ant.TestSpecificationTask.execute(TestSpecificationTask.ja
va:68)
        at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.j
ava:40)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)