我正试图围绕 canoo webtest
我设置了一个简单的 groovy 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)