`
MyEyeOfJava
  • 浏览: 1125203 次
  • 性别: Icon_minigender_1
  • 来自: 北京
博客专栏
7af2d6ca-4fe1-3e9a-be85-3f65f7120bd0
测试开发
浏览量:70188
533896eb-dd7b-3cde-b4d3-cc1ce02c1c14
晨记
浏览量:0
社区版块
存档分类
最新评论

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/
分享到:
评论
6 楼 MyEyeOfJava 2011-09-08  
spo22 写道
请问博主用ansicon测试内容包含中文时有没有出现乱码的情况(部分正常,部分乱码)?同样的脚本直接用cmd去执行测试,中文可以正常显示。

我的测试环境是:win7 64位+ruby1.9.2.290+cucumber-1.0.2+ansicon1.4


没有出现乱码,请保证你的操作系统语言为中文。
5 楼 spo22 2011-09-08  
请问博主用ansicon测试内容包含中文时有没有出现乱码的情况(部分正常,部分乱码)?同样的脚本直接用cmd去执行测试,中文可以正常显示。

我的测试环境是:win7 64位+ruby1.9.2.290+cucumber-1.0.2+ansicon1.4
4 楼 klobodnf 2011-08-23  
想用firefox的话用watir-webdriver吧、官网都说了、要放弃firefox了、watir2.0发布firewatir也还是1.9.x的版本、而且那个jssh插件官网现在也取消下载了、使用webdriver进行多浏览器是大势所趋
3 楼 Silverside 2011-07-26  
装好了,我原来的firefox是4.0的,不支持,后来换成3.6就可以了。

然后运行你的例子报错:
D:\Download>cucumber features/findError.feature
Unable to connect to machine : 127.0.0.1 on port 9997. Make sure that JSSh is pr
operly installed and Firefox is running with '-jssh' option (Watir::Exception::U
nableToStartJSShException)
D:/Ruby192/lib/ruby/gems/1.9.1/gems/firewatir-1.9.3/lib/firewatir/firefox.rb:156
:in `rescue in set_defaults'
D:/Ruby192/lib/ruby/gems/1.9.1/gems/firewatir-1.9.3/lib/firewatir/firefox.rb:148
:in `set_defaults'
D:/Ruby192/lib/ruby/gems/1.9.1/gems/firewatir-1.9.3/lib/firewatir/firefox.rb:43:
in `initialize'
D:/Download/features/features/support/env.rb:25:in `new'
D:/Download/features/features/support/env.rb:25:in `<top (required)>'
D:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.0.2/lib/cucumber/rb_support/rb_la
nguage.rb:143:in `load'
D:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.0.2/lib/cucumber/rb_support/rb_la
nguage.rb:143:in `load_code_file'
D:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.0.2/lib/cucumber/runtime/support_
code.rb:176:in `load_file'
D:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.0.2/lib/cucumber/runtime/support_
code.rb:78:in `block in load_files!'
D:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.0.2/lib/cucumber/runtime/support_
code.rb:77:in `each'
D:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.0.2/lib/cucumber/runtime/support_
code.rb:77:in `load_files!'
D:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.0.2/lib/cucumber/runtime.rb:137:i
n `load_step_definitions'
D:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.0.2/lib/cucumber/runtime.rb:39:in
`run!'
D:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.0.2/lib/cucumber/cli/main.rb:43:i
n `execute!'
D:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.0.2/lib/cucumber/cli/main.rb:20:i
n `execute'
D:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.0.2/bin/cucumber:14:in `<top (req
uired)>'
D:/Ruby192/bin/cucumber:19:in `load'
D:/Ruby192/bin/cucumber:19:in `<main>'
2 楼 MyEyeOfJava 2011-07-26  
Silverside 写道
请问,你jssh是怎么安装的?
在windows环境下。

JSSH是浏览器的一款插件,查看cucumber官网,里面有JSSH的安装步骤,启动时加-JSSH参数
1 楼 Silverside 2011-07-26  
请问,你jssh是怎么安装的?
在windows环境下。

相关推荐

Global site tag (gtag.js) - Google Analytics