[Webtest] Newbie - first test problem.
Gooshy GooSHY
webtest@lists.canoo.com
Fri, 1 Jul 2005 15:40:23 +0100
Hi,
I have just started using verion 1.7 of WebTest. I have the
application installed and can run selfTest.xml with no problems. I
have taken a copy of simpleTest.xml and edited it to suit my needs
shown below:
<project name=3D"InstallationCheck" basedir=3D"." default=3D"all">
<property name=3D"webtest.home" value=3D"${basedir}/../.."/>
<target name=3D"all" depends=3D"mayPrintANTError, checkWebTest"/>
<target name=3D"checkWebTest">
<echo message=3D"webtest.home is ${webtest.home}"/>
<testSpec name=3D"check calling and parsing alocal file">
<config
host=3D"localhost"
port=3D"8081"
basepath=3D"html"
summary=3D"true"
saveresponse=3D"true"
resultFile=3D"resutls"
haltonfailure=3D"true"
showhtmlparseroutput=3D"true"
protocol=3D"http">
<header name=3D"User-Agent"=20
value=3D"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT
5.1; SV1; .NET CLR 1.1.4322)"/>
<header name=3D"Accept-Language" value=3D"en"/>
<header name=3D"AUTHORIZATION" value=3D"BASIC
c2ltb246cGFzc3dvcmQ=3D"/>
<header name=3D"JavaScriptEnabled" value=3D"true"/>
</config>
<steps>
<invoke
description=3D"get login page"
url=3D"Main.html"/>
<verifyTitle
description=3D"check the title is parsed correctly"
text=3D"HomePage"/>
</steps>
</testSpec>
</target>
<target name=3D"checkANT">
<available classname=3D"org.apache.tools.ant.ProjectComponent"
property=3D"ant.version.ok"/>
</target>
<target name=3D"mayPrintANTError" unless=3D"ant.version.ok" depends=3D"=
checkANT">
<echo message=3D"You have a non-compliant version of ANT"/>
<echo message=3D"Consider moving WEBTESTHOME/lib/ant.jar"/>
<echo message=3D"to ANT_HOME/lib."/>
</target>
<taskdef file=3D"${webtest.home}/webtestTaskdefs.properties">
<classpath>
<pathelement path=3D"${webtest.home}/lib"/>
<fileset dir=3D"${webtest.home}" includes=3D"lib/*.jar"/>
<fileset dir=3D"${webtest.home}" includes=3D"lib/base/*.jar"/>
<fileset dir=3D"${webtest.home}" includes=3D"lib/optional/*.jar=
"/>
</classpath>
</taskdef>
</project>
When I run the all task I get the following error:
"C:\Program Files\Java\jdk1.5.0_03\bin\java.exe" -Xms64M -Xmx256M -cp
"C:\Program Files\Canoo\bin\..\lib\runtime\ant-launcher.jar"
-Dant.library.dir=3D"C:\Program Files\Canoo\bin\..\lib\runtime"
org.apache.tools.ant.launch.Launcher -lib "C:\Program
Files\Canoo\bin\..\lib\build;C:\Program
Files\Canoo\bin\..\lib\build\clover.jar" -buildfile test.xml
Buildfile: test.xml
Trying to override old definition of task sleep
checkANT:
mayPrintANTError:
checkWebTest:
[echo] webtest.home is C:\Program Files\Canoo\doc\samples/../..
[testSpec] (steps.Step 175 ) Start Step:
null "[implict setup step]" (1/4)
[testSpec] (steps.Setup 72 ) Using browser
version (Microsoft Internet Explorer, 4.0 (compatible; MSIE 6.0b;
Windows 98), Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;
.NET CLR 1.1.4322), 1.2). If the javascript support is not as
expected, then it's time to go into the sources
[testSpec] (steps.Setup 144 ) Configuring 4
HTTP header field(s)
[testSpec] (steps.Setup 150 ) Skipped
User-Agent header as it has already been configured in the
BrowserVersion
[testSpec] (steps.Setup 153 ) Configured
header "Accept-Language": en
[testSpec] (steps.Setup 153 ) Configured
header "AUTHORIZATION": BASIC c2ltb246cGFzc3dvcmQ=3D
[testSpec] (steps.Setup 153 ) Configured
header "JavaScriptEnabled": true
[testSpec] (steps.Step 175 ) Start Step:
invoke "get login page" (2/4)
[testSpec] (request.Target 148 ) ->
gotoTarget(by url): http://localhost:8081/html/Main.html
[testSpec] (request.Target 110 )
ScriptException: enclosed exception was "TypeError: Cannot read
property "userFrame" from undefined (Embedded script#9)"
[testSpec] (steps.Step 362 ) Exception
thrown from this class: com.canoo.webtest.engine.StepFailedException
[testSpec] (steps.Step 364 ) Message was:
Step[invoke "get login page" (2/4)]: Script error executing at: page -
url=3Dhttp://localhost:8081/html/Main.html
[testSpec] (ant.TestSpecificationTask 156 ) Writing report
using Report class: com.canoo.webtest.reporting.XmlReporter
[testSpec] (ant.TestSpecificationTask 172 ) Test summary
successfully created.
The error log is as follows:
<?xml version=3D"1.0" encoding=3D"ISO-8859-1"?>
<summary>
<testresult
location=3D"C:\Program Files\Canoo\doc\samples\test.xml:9: "
starttime=3D"Fri Jul 01 15:34:37 BST 2005"
successful=3D"no" testspecname=3D"check calling and parsing alocal =
file">
<config>
<parameter name=3D"showhtmlparseroutput" value=3D"yes"/>
<parameter name=3D"summary" value=3D"yes"/>
<parameter name=3D"protocol" value=3D"http"/>
<parameter name=3D"saveresponse" value=3D"yes"/>
<parameter name=3D"haltonerror" value=3D"yes"/>
<parameter name=3D"resultpath" value=3D"C:\Program
Files\Canoo\doc\samples"/>
<parameter name=3D"host" value=3D"localhost"/>
<parameter name=3D"haltonfailure" value=3D"yes"/>
<parameter name=3D"basepath" value=3D"html"/>
<parameter name=3D"resultfile" value=3D"resutls"/>
<parameter name=3D"port" value=3D"8081"/>
</config>
<results>
<step>
<parameter name=3D"description" value=3D"get login page"/>
<parameter name=3D"url" value=3D"Main.html"/>
<parameter name=3D"stepType" value=3D"invoke"/>
<result>
<failed duration=3D"1672"/>
</result>
<htmlparser>
<error col=3D"72" line=3D"4"
url=3D"http://localhost:8081/html/Main.html">Missing attribute
name.</error>
<error col=3D"74" line=3D"4"
url=3D"http://localhost:8081/html/Main.html">No Java character encoding
mapping for IANA character encoding "iso-8859-1".</error>
<error col=3D"72" line=3D"4"
url=3D"http://localhost:8081/html/Main.html">Missing attribute
name.</error>
<error col=3D"74" line=3D"5"
url=3D"http://localhost:8081/html/Main.html">Missing attribute
name.</error>
<error col=3D"105" line=3D"8"
url=3D"http://localhost:8081/html/Main.html">Missing whitespace before
attribute "src".</error>
<error col=3D"166" line=3D"8"
url=3D"http://localhost:8081/html/Main.html">Missing attribute
name.</error>
<error col=3D"78" line=3D"4"
url=3D"http://localhost:8081/html/Title.html">Missing attribute
name.</error>
<error col=3D"74" line=3D"6"
url=3D"http://localhost:8081/html/Title.html">No Java character encoding
mapping for IANA character encoding "iso-8859-1".</error>
<error col=3D"66" line=3D"1"
url=3D"http://localhost:8081/html/Title.html">DOCTYPE declaration found
inside document content.</error>
<error col=3D"78" line=3D"4"
url=3D"http://localhost:8081/html/Title.html">Missing attribute
name.</error>
<warning col=3D"9" line=3D"35"
url=3D"http://localhost:8081/html/Title.html">End element <td>
automatically closes element <font>.</warning>
<warning col=3D"18" line=3D"40"
url=3D"http://localhost:8081/html/Title.html">End element <table>
automatically closes element <tr>.</warning>
<error col=3D"163" line=3D"9"
url=3D"http://localhost:8081/html/Main.html">Missing attribute
name.</error>
<error col=3D"108" line=3D"1"
url=3D"http://localhost:8081/SearchDisplay.do">No Java character
encoding mapping for IANA character encoding "iso-8859-1".</error>
<warning col=3D"433" line=3D"6"
url=3D"http://localhost:8081/SearchDisplay.do">Inserting proper parent
element <tr> for element <td>.</warning>
<error col=3D"566" line=3D"6"
url=3D"http://localhost:8081/SearchDisplay.do">Missing attribute
name.</error>
<error col=3D"778" line=3D"6"
url=3D"http://localhost:8081/SearchDisplay.do">Missing attribute
name.</error>
<error col=3D"1073" line=3D"6"
url=3D"http://localhost:8081/SearchDisplay.do">Missing attribute
name.</error>
<warning col=3D"1317" line=3D"6"
url=3D"http://localhost:8081/SearchDisplay.do">Inserting proper parent
element <tr> for element <td>.</warning>
<error col=3D"1460" line=3D"6"
url=3D"http://localhost:8081/SearchDisplay.do">Missing attribute
name.</error>
<warning col=3D"1658" line=3D"6"
url=3D"http://localhost:8081/SearchDisplay.do">Inserting proper parent
element <tr> for element <td>.</warning>
<error col=3D"1812" line=3D"6"
url=3D"http://localhost:8081/SearchDisplay.do">Missing attribute
name.</error>
<error col=3D"2383" line=3D"6"
url=3D"http://localhost:8081/SearchDisplay.do">Missing attribute
name.</error>
<error col=3D"2612" line=3D"6"
url=3D"http://localhost:8081/SearchDisplay.do">Missing attribute
name.</error>
<error col=3D"2847" line=3D"6"
url=3D"http://localhost:8081/SearchDisplay.do">Missing attribute
name.</error>
<error col=3D"3083" line=3D"6"
url=3D"http://localhost:8081/SearchDisplay.do">Missing attribute
name.</error>
<error col=3D"3321" line=3D"6"
url=3D"http://localhost:8081/SearchDisplay.do">Missing attribute
name.</error>
<error col=3D"3578" line=3D"6"
url=3D"http://localhost:8081/SearchDisplay.do">Missing attribute
name.</error>
<warning col=3D"3680" line=3D"6"
url=3D"http://localhost:8081/SearchDisplay.do">Inserting proper parent
element <tr> for element <td>.</warning>
<error col=3D"3875" line=3D"6"
url=3D"http://localhost:8081/SearchDisplay.do">Missing attribute
name.</error>
<error col=3D"4348" line=3D"6"
url=3D"http://localhost:8081/SearchDisplay.do">Missing attribute
name.</error>
<error col=3D"4431" line=3D"6"
url=3D"http://localhost:8081/SearchDisplay.do">Missing attribute
name.</error>
<error col=3D"4438" line=3D"6"
url=3D"http://localhost:8081/SearchDisplay.do">Missing attribute
name.</error>
</htmlparser>
</step>
<step>
<parameter name=3D"text" value=3D"HOMEPAGE/>
<parameter name=3D"description" value=3D"check the title
is parsed correctly"/>
<parameter name=3D"stepType" value=3D"verifyTitle"/>
<result>
<notexecuted duration=3D"0"/>
</result>
</step>
<failure
message=3D"com.canoo.webtest.engine.StepFailedException: Step[invoke
"get login page" (2/4)]: Script error executing at: page -
url=3Dhttp://localhost:8081/html/Main.html, Step: InvokePage at
C:\Program Files\Canoo\doc\samples\test.xml:29: with
(description=3D"get login page", url=3D"Main.html",
stepType=3D"invoke")"/>
</results>
</testresult>
</summary>
The page returns the correctly in a browser and displays fine. If
anyone can shed any light on what I am doing wrong then I'd appreciate
it.
Thanks
Scott.