`
zawa
  • 浏览: 58146 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

前端自动化测试套件

阅读更多

详见我的博客:http://www.zawaliang.com/2013/02/214.html

 

作为前端开发人员,前端的自动化测试一直是个很棘手的问题,尤其是涉及UI交互层面的。传统的手工测试方式实在太落后以及重复劳动了,程序员就是懒人,总得想方设法释放自己的劳动力。

最近项目没那么忙了,抽点时间了解了下现有的一些自动化测试框架套件,此文只是抛砖引玉,本人也是小白。Grimace

 

PhantomJS

http://phantomjs.org/

PhantomJS是一个无界面的Webkit,使用Javascript API操作,因为对于前端开发人员而言入门门槛较低。而且还支持常见的测试套件,如Jasmine、QUnit、Mocha等等。

其支持以下主要功能:

  • screentshot   截屏
  • Page Loading   测速
  • Code Evaluation   沙箱化的Javascript执行环境
  • Page Automation    DOM操作,支持使用jQuery等
  • Network Requests and Responses    网络请求与响应

 

CasperJS

http://casperjs.org/

CasperJS是一个使用Javascript编写的,基于PhantomJS的导航脚本及测试套件,它简化了定义一个完整导航的操作处理,提供了有用的高级函数、方法以及语法糖。
具体的参考https://github.com/n1k0/casperjs

 

Zombie.js

http://zombie.labnotes.org/

Zombie.js 也是一个无界面的,基于Node.js的测试套件。安装它之前需要先安装Node.js、NPM、C++ Compiler以及Python。语法风格很友好,Dom操作使用Sizzle.js,学习成本低。就是在windows下安装比较麻烦,折腾。

C++ Compiler 编辑器列表
http://www.stroustrup.com/compilers.html

windows下可以选择mingw http://mingw.org/

 

Zombie.js 支持以下功能:

  • HTML5 parsing and dealing with tag soups
  • DOM Level 3 implementation
  • HTML5 form fields (search, url, etc)
  • CSS3 Selectors with some extensions
  • Cookies and Web Storage
  • XMLHttpRequest in all its glory
  • setTimeout/setInterval
  • pushState, popstate and hashchange events
  • alert, confirm and prompt
  • WebSockets and Server-Sent Events

 

Watir WebDriver

http://watirwebdriver.com/

Watir基于Ruby,支持多浏览器。这里说一下Watir的安装(windows)

  1. 安装Ruby
    http://rubyinstaller.org/

  2. 安装Rubygems
    国内可能被墙,可使用淘宝镜像:http://ruby.taobao.org/ 
  3. 安装Watir
    windows下需先安装DevKit
    http://rubyinstaller.org/downloads/
    https://github.com/oneclick/rubyinstaller/wiki/Development-Kit 

    对于使用代理上网的,需要设置代理
    set HTTP_PROXY=127.0.0.1:8888
    gem install watir-webdriver

  4. 安装浏览器支持
    默认是支持Firefox的,IE、Chrome、Safari需要另外下载driver配置,将下载到的文件放到Ruby Path里(如:E:\Ruby192\bin)
    IE:http://code.google.com/p/selenium/downloads/list
    Chrome:http://code.google.com/p/chromedriver/downloads/list 

    safari安装参考:
    http://code.google.com/p/selenium/wiki/SafariDriver
    http://17test.info/?page_id=625

 

Selenium 2 (又名Selenium WebDriver)

Selenium2是一个集成了WebDriver的测试框架
Watir WebDriver是Selenium WebDriver的一个封装,api更友好。但watir使用ruby进行开发,而selenium2可使用多种语言,如ruby、java等进行开发

IBM Selenium 2 入门
http://www.ibm.com/developerworks/cn/web/wa-selenium2/index.html

 

 

 

详见我的博客:http://www.zawaliang.com/2013/02/214.html

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics