我知道功能输出中的蓝色破折号意味着该步骤被跳过,因为它失败之前的某些事情但在我的所有场景大纲中,我都得到了蓝色破折号,但还有一条表示所有通过的行。
这是我的场景大纲。
Scenario Outline: Attempt to assign a role when not authorized
Given a <user_who_can_not_assign_roles> exists with email: "[email protected]"
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 "[email protected]"
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 个步骤。
我认为这是在运行大纲时的目的,因为如果我更改标有蓝色破折号的步骤,它将显示失败。我只是在 cucumber 文档中寻找一些确认,但找不到任何东西。
我正在运行 rails 3.0.0、cucumber 0.9.3 和 pickle 0.4.2。
最佳答案
本例中的蓝色破折号表示对场景大纲的解析,这是比测试更多的元数据。我也觉得很困惑。为了更好地了解正在发生的事情,请尝试执行:
cucumber -f pretty <your_fancy_scenario.feature>
这将强制 cucumber 显示带有颜色编码的实际场景文本,而不仅仅是点和破折号。
希望有帮助!
关于ruby-on-rails-3 - cucumber 特征输出中的蓝色破折号是否总是意味着跳过?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4064187/