博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Selenium 中如何自动记录测试结果

Posted on 2007-03-19 17:50  Jackei  阅读(2673)  评论(5编辑  收藏  举报
虽然 Selenium 的网站上说到可以通过使用 auto=true 参数来自动执行脚本,并同事记录测试结果,可是试了很多次都是不行。今天专门翻了一天的资料,终于弄明白了 Selenium 中的 postReuslts 是怎么一回事。原文如下:

Selenium can't actually write to a file directly. In "auto" mode,
Selenium will POST results to a URL, where it expects to find a "results
handler". The default URL is "/postResults". So, you need to implement
a "results handler" (typically a CGI-script, Java servlet, or similar),
and arrange for it to be "mounted" at "http://yourserver/postResults"
(see the Selenium manual for details of what data gets POSTed). Your
handler can record the result data however you wish; writing to a file
is fairly standard.

You can specifiy an alternative handler location by providing a
"resultsUrl" parameter - but beware that, unless you're using HTA, it
needs to be on the same server as Selenium, as posting of results is
subject to the same cross-site scripting restrictions as the rest of
Selenium.

原文出处:http://forums.openqa.org/thread.jspa?threadID=554&tstart=150