cucumber环境搭建

上一篇 / 下一篇  2015-11-14 23:51:18

BDD:行为驱动开发
cucumber是基于ruby的

#@Sce,S0
首先安装ruby:
http://rubyinstaller.org/downloads/
51Testing软件测试网9F4XY}%sI
安装cucumber:执行
gem install rspec
gem install cucumber
51Testing软件测试网@n;Tl?O0c@
可能会报错如下:镜像地址被墙了,
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    Errno::ECONNABORTED: An established connection was aborted by the software i
n your host machine. - SSL_connect (https://api.rubygems.org/quick/Marshal.4.8/c
ucumber-2.1.0.gemspec.rz)
需要修改下镜像的地址
$ gem sources --remove https://rubygems.org/
$ gem sources -a https://ruby.taobao.org/
$ gem sources -l
51Testing软件测试网,Xz,]C(l/ifxTa
安装完成后,因为windows的命令行不支持彩色字符,需要下载ansion
https://github.com/adoxa/ansicon
51Testing软件测试网,v?-F}keI
下载完成后,直接双击目录下的ansicon.exe来启动cmd,执行cucumber时,就可以看到彩色效果
51Testing软件测试网TXu0g8g*j L l
建立个文件夹cucumber(名字任意),命令行进入,执行cucumber --init,即可建立features的目录结构,在features下建立.feature文件,step_definitions下建立步骤文件,
(详见http://ningandjiao.iteye.com/blog/1483894)
cucumber文件夹下直接执行cucumber,,可以看到执行结果:
java中运用cucumber可以参考:
Using Cucumber tests with Maven and Java
http://www.goodercode.com/wp/using-cucumber-tests-with-maven-and-java/

TAG:

 

评分:0

我来说两句

Open Toolbar