最新消息:

基于Firefox的操作自动化工具

技术 admin 3499浏览 2评论

    用于摘录各种觉得有价值的文章的digg系统,最近老是被一帮老外不停灌水,每天都要花很多时间去手动删除这些帖子。pligg的管理后台并没有提供帖子直接删除功能,只能将帖子状态置为discard状态,然后通过dreamhost主机提供的phpmyadmin去执行sql语句删除状态置为discard的帖子,过程极其麻烦,于是希望能够将登录phpmyadmin管理界面及执行sql的过程自动化。另外在日常软件功能测试中,其实也有很多类似的需要重复执行的事情。

    像Loadrunner这样的测试自动化工具在功能是能够较好满足需要,但这样的工具太好、太强大了,用于我这些相对简单的应用有点大材小用,找了一些基于firefox的能够处理自动化操作的扩展。

    来个十全大补丸,主要有如下一些Firefox的扩展支持操作自动化功能:

    1、Selenium IDE:http://seleniumhq.org/projects/ide/

    2、iMacros:https://addons.mozilla.org/en-US/firefox/addon/3863

    3、Dejaclick:http://www.dejaclick.com/

    4、Coscripter:http://coscripter.research.ibm.com/coscripter

    5、Molybdenum:http://www.molyb.org

    6、Chickenfoot:http://groups.csail.mit.edu/uid/chickenfoot/index.php

    7、Windmill Testing Framework:http://www.getwindmill.com/

    8、TestGen4Web:http://developer.spikesource.com/wiki/index.php/Projects:TestGen4Web

    9、FireWatir:http://code.google.com/p/firewatir/

    10、TestMaker:http://www.pushtotest.com/

     简单测试了一下如上几个工具,初步的感觉如下:

    iMacros:iMacros for Firefox号称“你能用 Firefox 做的事,iMacros 都可以自动化帮你完成”,从功能而言,iMacros还是比较全面和灵活的,按照此官方说法,其典型的应用的场景包括:填表器和密码管理器、自动下载和上传、数据提取、网页测试、社会型脚本(社会型书签)等。因此开始选择了iMacros来测试,使用倒是挺方便的,但在录制脚本过程中遇到了很多问题(包括iMacros for IE也存在问题),感觉iMacros尽管似乎功能强大,但并不是很稳定,与其他Firefox扩展也存在冲突。在测试执行登录phpmyadmin并删除操作时候存在开启多个Tab的现象,始终报“RuntimeError: Tab number 2 does not exist, line 6”这样的错误、,测试iMacros带的“Demo-Tabs.iim”的例子,也是报“RuntimeError: Tab number 4 does not exist, line 6”。怀疑是与Tab Mix Plus及其他扩展冲突,后来在干净的Firefox中测试发现,都是Block pop-up windows惹的祸,将mysql.yeeach.com加入信任站点后可以,但测试自动化登录sina邮箱时候,始终报“RuntimeError: Tab number 4 does not exist, line 5”,放弃。

   Selenium IDE:Selenium IDE应该是基于Firefox最为出名的Web自动化测试工具了,可以用于功能测试、验收测试。通过Selenium IDE可以轻易地在浏览器中录制和回放测试,也可以手工编辑测试,可设置断点进行调试,可把测试保存到HTML、Ruby、C#、Java等其他脚本格式,然后使用Selenium RC来实现并运行更加灵活和强大的测试。Selenium IDE其实是ThoughtWorks的Selenium测试工具中的其中一个,Selenium由三部分组成:Selenium IDE、Selenium Core、Selenium Remote Control。但对于普通用户而言,易用性还是一般。Molybdenum也是基于Selenium的。

    DéjàClickDéjàClick的定位是Web性能监控(Web performance monitoring system)。Alertsite提供了一系列的工具集服务,可以应用于Availability monitoring、Performance monitoring、Web transaction monitoring、Service level monitoring等领域,很专业的Web performance monitoring工具,具体可以参考Dejaclick的官方网站了解Dejaclick的各种服务。作为自动化工具,dejaclick其不仅提供了脚本录制、回放功能,在回放时候,对每一步操作的性能指标(例如对User Pause Timings、Rendering Timings、Network Timings进行了区分)有较为详细的报告,用于性能分析、调优等还是很有用。DejaClick易用性较好,很容易上手,因此选择了此工具来完成我的操作。有空再单独研究一下dejaclick的细化用法。

    Coscripter:源自IBM的产品,基于Greasemonkey,目标很诱人,只不过现实与口号及目标尚有很大距离,目前只能完成一些简单的操作,易用性也较差,放弃。关于coscripter与Greasemonkey的差异,这儿有一个较为详细的描述:

        there are a couple differences between CoScripter and Greasemonkey/userscripts. The main one is that CoScripter is targeted at non-programmers, while GM does require some JavaScript skill to create custom scripts. CoScripts are also designed to be easy to read and transparent to operate — you can see CoScripter in action as it automates a website, whereas with a GM script you have to trust that it does the right thing unless you want to read the code carefully.
        On the other hand, GM is more about customizing web pages and CoScripter is more about automating process flow through web applications. So GM has more features related to removing or adding content from web pages, whereas CoScripter is more targeted at form-filling and navigating through a sequence of pages.

    Chickenfoot:与Greasemonkey类似,源自MIT,很学院化,很有理论高度(可是得到了MIT的Winner of best paper award的论文),尤其是那几篇关于Chickenfoot的论文对于理解Chickfoot的架构及设计思想很有参考价值。Automation and Customization of Rendered Web PagesEnd-user Programming for the WebNaming Page Elements in End-User Web Automation

    TestMaker、Molybdenum、Windmill Testing Framework 、TestGen4Web、FireWatir的定位都是Web测试工具(还有Htmlunit),有空与Selenium 对比一下异同。

    总体而言,dejaclick、Selenium 、Chickenfoot、TestGen4Web都值得好好研究。

转载请注明:出家如初,成佛有余 » 基于Firefox的操作自动化工具

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

网友最新评论 (2)

  1. Hi Chuan, = I have used Google to translate this page = I wanted to thank you for utilizing our DejaClick automation web recording tool. I appreciate your inclusion of our software in your analysis. I will be your Performance Advisor working with you on your evaluation of our service. Please feel free to reach out to me for assistance. ~ Louis Huynh
    Louis Hunh15年前 (2009-04-30)回复
  2. Greatings, Everything dynamic and very positively! 🙂
    Rufor15年前 (2009-05-02)回复