【问题标题】:How to execute .feature file in cucumber如何在黄瓜中执行 .feature 文件
【发布时间】:2013-03-28 06:53:22
【问题描述】:

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

【问题讨论】:

标签: cucumber


【解决方案1】:

因为它希望你在 BDD 中取得成功,所以 cucumber 将引导你完成整个过程。在项目目录中,在 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)。然后,使用适当的代码编辑您的步骤定义文件以执行该步骤。

【讨论】:

    猜你喜欢
    • 2018-04-23
    • 2022-08-04
    • 1970-01-01
    • 1970-01-01
    • 2016-12-23
    • 1970-01-01
    • 2017-10-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多