加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails-3 – 黄瓜功能输出中的蓝色短划线是否总是意味着

发布时间:2020-12-17 02:27:33 所属栏目:百科 来源:网络整理
导读:我已经明白功能输出中的蓝色短划线意味着跳过了一步,因为它失败了,但在我的所有场景概述中,我得到蓝色破折号,但也有一条说明全部通过的行. 这是我的场景大纲. Scenario Outline: Attempt to assign a role when not authorized Given a user_who_can_not_ass
我已经明白功能输出中的蓝色短划线意味着跳过了一步,因为它失败了,但在我的所有场景概述中,我得到蓝色破折号,但也有一条说明全部通过的行.

这是我的场景大纲.

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.

解决方法

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

cucumber -f pretty <your_fancy_scenario.feature>

这将迫使黄瓜用颜色编码显示实际的场景文本,而不仅仅是点和短划线.

希望有所帮助!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读