我试图围绕canoo webtest
我设置了一个简单的常规webtest。 我甚至制作并运行了xml等价物,当它尝试编码url时我得到了同样的错误。
使用上下文根时出错。
当我只使用带有上下文根的url时,我不会收到错误。 ie."http://somesite.com"
除了有额外的字母之外还有另外一个斜线,但显然愚蠢的字节码解码器可以处理带有http://部分的斜杠...为什么不像目录那样简单
我认为webtest能够处理像站点内的目录或上下文根目录这样简单的事情,或者至少能够正确地检测和编码数据。如果您正在编写名为“Web”测试的应用程序,那么加载任何类型的URL都是至关重要的。
invoke(url: "http://somesite.com/CONTEXTRoot", description: "Load dev java site")
verifyTitle("Title to check")
或
<?xml version="1.0" ?>
<!DOCTYPE project SYSTEM "../dtd/Project.dtd">
<project default="test">
<target name="test">
<webtest name="check login and welcome page load and work">
<invoke description="Go to dev site"
url="http://devsite.com/CONTEXTRoot/" />
<clickButton label="Enter Application" />
</webtest>
</target>
</project>
堆栈跟踪:
E:\canoo\WebSiteFunctionalTests\tests\WebSiteWebTest.xml:11: Unexpected exception caught: sun.io.MalformedInputException
at com.canoo.webtest.steps.StepUtil.handleException(StepUtil.java:120)
at com.canoo.webtest.steps.Step.handleException(Step.java:379)
at com.canoo.webtest.steps.Step.execute(Step.java:110)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
...
Caused by: sun.io.MalformedInputException
at sun.io.ByteToCharUTF8.convert(ByteToCharUTF8.java:262)
at sun.nio.cs.StreamDecoder$ConverterSD.convertInto(StreamDecoder.java:314)
at sun.nio.cs.StreamDecoder$ConverterSD.implRead(StreamDecoder.java:364)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:250)
at java.io.InputStreamReader.read(InputStreamReader.java:212)
at org.cyberneko.html.HTMLScanner.load(HTMLScanner.java:1166)
at org.cyberneko.html.HTMLScanner.read(HTMLScanner.java:1127)
at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:1913)
at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:893)
at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:495)
at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:448)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:680)
at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:240)
at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:127)
at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:101)
at com.canoo.webtest.engine.Configuration$2.createPage(Configuration.java:655)
答案 0 :(得分:0)
当我在jsp
中更改元标记和页面标记时,我将其用于调用这
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
到
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
我提交了一个关于此问题的JIRA错误,因为错误只发生在调用期间,而不是在表单提交和链接点击上。