wiki:autotest

Version 6 (modified by qinhongyuan, 14 years ago) (diff)

--

自动化测试

  • selenium

该测试框架对Firefox完美支持,其它浏览器的兼容性能有待商榷
可以使用多种语言编写测试用例,可以使用Java,但是推荐使用ruby来编写,因为使用ruby来编写的话,语言简洁很多,而且测试人员可以很简单地去编写Ruby脚本
具有录制功能,但是只针对在firefox下,录制生成的脚本可以转为各种语言的测试用例。


安装:

  • 下载ruby 安装 , 修改系统path配置 , 命令行输入ruby -v
  • 下载DevKit 安装 (安装时,路径不要有空格)
  • 到DevKit安装目录,命令行
    > cd <DEVKIT_INSTALL_DIR>
    > ruby dk.rb init
    #生成config.yml,这里会检查将要添加DevKit支持的Ruby列表,只支持通过RubyInstaller安装的Ruby
    #如果这里列出的Ruby与你的要求不符,可以手动修改
    > ruby dk.rb review  #检查要添加DevKit支持的Ruby列表是否有误,可以略过
    > ruby dk.rb install
    [INFO] Updating convenience notice gem override for 'C:/Ruby192'
    [INFO] Installing 'C:/Ruby192/lib/ruby/site_ruby/devkit.rb'
    >
    
  • 检查是否安装成功
    > gem install selenium-webdriver
    
  • selenium-webdriver 就是测试工具,安装成功即可
    C:\Documents and Settings\pc>gem install selenium-webdriver
    Temporarily enhancing PATH to include DevKit...
    Building native extensions.  This could take a while...
    Fetching: childprocess-0.3.2.gem (100%)
    Fetching: addressable-2.2.8.gem (100%)
    Fetching: libwebsocket-0.1.3.gem (100%)
    Fetching: selenium-webdriver-2.21.2.gem (100%)
    Successfully installed ffi-1.0.11
    Successfully installed childprocess-0.3.2
    Successfully installed addressable-2.2.8
    Successfully installed libwebsocket-0.1.3
    Successfully installed selenium-webdriver-2.21.2
    5 gems installed
    Installing ri documentation for ffi-1.0.11...
    Installing ri documentation for childprocess-0.3.2...
    Installing ri documentation for addressable-2.2.8...
    Installing ri documentation for libwebsocket-0.1.3...
    Installing ri documentation for selenium-webdriver-2.21.2...
    Installing RDoc documentation for ffi-1.0.11...
    Installing RDoc documentation for childprocess-0.3.2...
    Installing RDoc documentation for addressable-2.2.8...
    Installing RDoc documentation for libwebsocket-0.1.3...
    Installing RDoc documentation for selenium-webdriver-2.21.2...
    
  • 编写第一个案例,打开netbeans ,新建ruby工程