2013-03-28 72 views
1

我是黄瓜的初学者。我在互联网的帮助下安装了黄瓜。我写了一个.feature文件。但是我不知道在哪里放置这个文件以及如何执行它。如何在黄瓜中执行.feature文件

+1

看看[良好的黄瓜教程不依赖于铁轨](http://stackoverflow.com/q/5688757/841064) – 2013-03-28 07:46:26

回答

1

因为它希望你在BDD中取得成功,所以黄瓜会指导你完成整个过程。从项目目录,在命令提示符或终端类型cucumber,它返回:

You don't have a 'features' directory. Please create one to get started. 

创建features目录,并把你的.feature文件在里面。再次运行cucumber,它返回映射到您的feature文件的待定步骤定义。举个例子:

You can implement step definitions for undefined steps with these snippets: 

Given /^I want to use cucumber$/ do 
    pending # express the regexp above with the code you wish you had 
end 

现在 - 作为@siekfried指示 - 创建一个名为features/step_definitions您的步骤定义文件的目录,它应与_steps(例如,example_steps.rb)结束。然后,使用适当的代码编辑您的步骤定义文件以执行步骤。