如何在黄瓜中执行.feature文件

时间:2013-03-28 06:53:23

标签: cucumber

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

1 个答案:

答案 0 :(得分:1)

因为它希望您在BDD中取得成功,所以黄瓜会引导您完成整个过程。从项目目录中,在cmd提示符或终端中键入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)。然后,使用适当的代码编辑步骤定义文件以执行该步骤。

相关问题