cucumber+Firewatir环境搭建

应他人需求搭建故事驱动,黄瓜的Ruby自动化测试环境,特总结如下:
1.安装Ruby  1.8.7运行环境,exe文件一键安装
2.在XP上会在C盘默认创建Ruby相关文件,安装时选中将Ruby作为该机器的环境变量
3.安装完ruby后,ruby自带Gem套件,使用Gem套件安装Firewatir,命令为gem install xxx
4.安装Firewatir成功后,可以运行Firewatir的脚本了,这个时候如果Firewatir不运行的话,可以使用webdriver版得watir来调用你的Firefox,这样Watir脚本既可以执行了
5.安装cucumber黄瓜,gem install cucumber安装黄瓜的时候可能会需要Json或者其他gem文件需要你提前安装
5.5安装kit-dev+Json,安装Kit后将Kit的所有Bin目录放置到环境变量里。然后运行gem install json
6.cucumber  xxxx.featrue即可运行你的黄瓜脚本
6.5.提示错误require,安装web-driver,命令为gem install watir-webdriver
6.5.1 提示require错误 安装rspec,命令为gem install rspec,此时能打开浏览器,然后再提示没有jssh,安装jssh
6.5.2 用虚拟机重试的时候,能启动浏览器但不能运行我的测试脚本,怀疑可能性为该网址内容--http://www.natontesting.com/2009/07/24/firewatir-jssh-unable-to-connect-fixed/该部分将会在下次使用时,敲定
7.运行时结果不是彩色的,会提示你安装ansicon,则你到http://adoxa.110mb.com/ansicon/网站去下载ansicon
8.
1. Download and unzip the file from http://adoxa.110mb.com/ansicon
2. open cmd and navigate to the unzipped folder
3. Navigate to x64 (if you have a 64 bit machine) otherwise navigate to x86
4. Type ansicon.exe -h and you will get the following:
D:\Data\ansicon\x86>ansicon.exe -h
ANSICON by Jason Hood .
Version 1.32 (22 December, 2010).  Freeware.
http://ansicon.adoxa.cjb.net/

Process ANSI escape sequences in Win32 console programs.

ansicon -i|I | -u|U
ansicon [-m[]] [-p | -e|E string | -t|T [file(s)] | program [args]]

  -i            install - add ANSICON to the AutoRun entry (implies -p)
  -u            uninstall - remove ANSICON from the AutoRun entry
  -I -U         use local machine instead of current user
  -m            use grey on black ("monochrome") or  as default color
  -p            hook into the parent process
  -e            echo string
  -E            echo string, don't append newline
  -t            display files ("-" for stdin), combined as a single stream
  -T            display files, name first, blank line before and after
  program       run the specified program
  nothing       run a new command processor, or display stdin if redirected

 is one or two hexadecimal digits; please use "COLOR /?" for details.
5. Execute 'ansicon.exe -i' to install and add ansicon to your Windows
6. Run your cucumber 0.10.0 test and you should 
get the coloured output result on Windows

这步做完你的故事驱动测试就可以开始了,哦,有可能你会需要一些黄瓜的脚本范例,那么去黄瓜的官网上去找,是可以下载的。网址为:http://cukes.info/

你可能感兴趣的:(json,脚本,XP,Ruby,rspec)