黄瓜特征输出中的蓝色破折号是否总是意味着跳过?

时间:2010-10-31 17:28:36

标签: ruby-on-rails-3 cucumber pickle

我已经明白功能输出中的蓝色破折号表示该步骤被跳过,因为它失败了之前的某些内容,但在我的所有情景大纲中,我得到蓝色破折号,但也有一条说明全部通过的行。

这是我的场景大纲。

Scenario Outline: Attempt to assign a role when not authorized
  Given a <user_who_can_not_assign_roles> exists with email: "johndoe@example.com"
  And that user is signed in
  And I am on the user's show page
  And a role exists with name: "<other_role1>"
  And a role exists with name: "<other_role2>"
  When I follow "Edit"
  Then I should not see "Admin"
  And I should not see "Manager"
  And I should not see "Salesperson"
  When I fill in "username" with "spuds"
  And I fill in "password" with "potatoes"
  And I fill in "password confirmation" with "potatoes"
  And I fill in "email" with "spuds@gmail.com"
  And I press "Save"
  Then I should see "success"
  And a role should exist with name: "<other_role1>"
  And that role should not be one of the user's roles
  And a role should exist with name: "<other_role2>"
  And that role should not be one of the user's roles

  Examples:
    | user_who_can_not_assign_roles | other_role1 | other_role2 |
    | manager                       | Admin       | Salesperson |
    | salesperson                   | Admin       | Manager     |

当我运行此功能时,我得到了这个输出。

-------------------......

2个场景(2个通过)
38步(38通过)
0m3.300s

我得到了它的2个场景,因为我列出了2个例子,38个步骤将是19个跑两次。我不明白的是为什么它会显示蓝色破折号(就像它通常显示跳过的步骤一样),当它也说过38步时。

我认为这是在运行大纲时的意图,因为如果我更改标有蓝色短划线的步骤,它将显示失败。我只是想在黄瓜文档中找到一些确认,我找不到任何东西。

我正在运行rails 3.0.0,黄瓜0.9.3和pickle 0.4.2。

1 个答案:

答案 0 :(得分:4)

在这种情况下,蓝色短划线表示场景大纲的解析,这是比测试更多的元数据。我发现它也令人困惑。为了更好地了解正在发生的事情,请尝试执行:

cucumber -f pretty <your_fancy_scenario.feature>

这会强制黄瓜显示带有颜色编码的实际场景文本,而不仅仅是点和短划线。

希望有所帮助!