红宝石轨道 – “耙子”运行我所有的黄瓜测试,但“黄瓜”没有步骤

前端之家收集整理的这篇文章主要介绍了红宝石轨道 – “耙子”运行我所有的黄瓜测试,但“黄瓜”没有步骤前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我继承了Rails(3)应用程序,并试图掌握现有的黄瓜测试.我在应用程序的“features”文件夹中有以下设置(我错过了任何不相关的文件,例如额外的功能和步骤)
  1. /features
  2. /people
  3. new-person.feature
  4. /step_definitions
  5. people_steps.rb
  6. web_steps.rb
  7. /support
  8. env.rb
  9. paths.rb
  10. selectors.rb

如果我运行’rake’,那么它会运行feature / people / new-person.feature中的所有功能,正确使用step_definitions中列出的步骤.

但是,我不想每次运行耙子,因为它需要太长时间,我只想在黄瓜中运行一个特定的测试,例如黄瓜特色/ people / new-person.feature -l 8

当我这样做,它运行的功能,但没有加载步骤.我回来了

  1. Using the default profile...
  2. Feature: Add a new person
  3. In order to allocate tasks to people
  4. As a community manager
  5. I want to add a new person
  6.  
  7. Scenario: Secondary navigation should contain "Add new person" # features/people/new-person.feature:8
  8. Given I am on the new person page # features/people/new-person.feature:9
  9. Undefined step: "I am on the new person page" (Cucumber::Undefined)
  10. features/people/new-person.feature:9:in `Given I am on the new person page'
  11. Then I should not see "Add new person" # features/people/new-person.feature:10
  12. Undefined step: "I should not see "Add new person"" (Cucumber::Undefined)
  13. features/people/new-person.feature:10:in `Then I should not see "Add new person"'
  14.  
  15. 1 scenario (1 undefined)
  16. 2 steps (2 undefined)
  17. 0m0.005s
  18.  
  19. You can implement step definitions for undefined steps with these snippets:
  20.  
  21. Given /^I am on the new person page$/ do
  22. pending # express the regexp above with the code you wish you had
  23. end
  24.  
  25. Then /^I should not see "([^"]*)"$/ do |arg1|
  26. pending # express the regexp above with the code you wish you had
  27. end
  28.  
  29. If you want snippets in a different programming language,just make sure a file
  30. with the appropriate file extension exists where cucumber looks for step definitions.

黄瓜为什么不加载步骤?我猜想我需要在某个地方采取步骤,但是我无法解决问题.

谢谢,最大

解决方法

马克斯·威廉姆斯找到了他的问题的答案:

编辑 – 找到答案,这里:https://rspec.lighthouseapp.com/projects/16211/tickets/401-envrb-not-loaded-when-running-individual-features-in-sub-directories

在config / cucumber.yml中有一行如下所示:

std_opts =“–format#{ENV [‘CUCUMBER_FORMAT’] ||’pretty’} –strict –tags〜@ wip”

把它改成

std_opts =“–format#{ENV [‘CUCUMBER_FORMAT’] ||’pretty’} –strict –tags〜@ wip –require features /”

这就像添加 – 要求功能/到黄瓜测试运行结束,并使其正常加载所有.

猜你在找的Ruby相关文章