你如何将黄瓜情景标记为待定

jsp*_*ner 42 ruby rspec cucumber

如何将黄瓜方案标记为待定,以便它不被视为已通过?

Scenario: Guest should not see edit link
# pending implementation
Run Code Online (Sandbox Code Playgroud)

我不应该标记为待定?

Jai*_*yer 58

我发现@wip标签的问题在于它不会使您的测试套件变黄.它完全忽略了wip功能,你往往会忘记它们的存在.当场景被标记为@wip然后被遗忘时,这会让我的团队陷入困境.我希望有更好的解决方案.我最好的是添加这个自定义步骤:

Given /^PENDING/ do
  pending
end
Run Code Online (Sandbox Code Playgroud)

我没有将真实的功能标记为待处理,而是将其添加到带有消息的阵容中,如下所示:

Given PENDING: we need client input
Run Code Online (Sandbox Code Playgroud)

然后它显示如下:

(::) pending steps (::)

features/example.feature:15:in `Given PENDING: we need client input'
Run Code Online (Sandbox Code Playgroud)

待定暂停测试链,但它不会阻止黄瓜在同一场景中唠叨任何未定义的步骤.此外,理想情况下,失败和待处理的功能会告诉您失败的方案的名称,但它们不会.

  • 我有一个类似的概念,即在我工作的黄瓜套件中添加一种"关键字".这里我们可以将步骤定义实现为`Given(/ ^ Pending(.*)/)do | reason | 未决的(原因); end`.然后,您将在场景中编写第一个Gherkin步骤为"*等待我们需要客户端输入".这会将其他步骤标记为自动跳过. (2认同)

ave*_*ell 23

另一种可能性是@wip标签(正在进行中).标记为@wip的方案默认情况下不会运行,但只是在您明确请求它们时.

@wip
Scenario: New product form should have some special field
  Given I still work on this feature
Run Code Online (Sandbox Code Playgroud)

这样,您可以从自动构建中排除某些方案,以便在您处理该功能时不会中断.

  • 似乎@wip标签消失了(黄瓜1.1.9) (3认同)

jsp*_*ner 21

好的想出来了.

如果在任何步骤文件中找不到Scenarios步骤,则将其标记为挂起.

Scenario: New product form should have some special field
  Given joe is logged in as an user
  When on the new exercise page
  Then the select field should have some special field
Run Code Online (Sandbox Code Playgroud)

它甚至足以完成未决步骤.

When /^on the new exercise page$/ do
  pending # express the regexp above with the code you wish you had
end
Run Code Online (Sandbox Code Playgroud)