【问题标题】:Running cucumber table automatically自动运行黄瓜表
【发布时间】:2018-01-13 16:06:26
【问题描述】:

我有这样一个数据表的黄瓜场景:

场景:登录功能

给定登录屏幕

当我输入电子邮件<Email> 和密码<Password>

| Email   | Password     |

| xxxxxx  | mypassword   |

| abcde   | mypassword   |

|         | mypassword   |

|         |              |

那么登录应该是不成功的

如何以自动方式为所有表格行运行该步骤。我发现的唯一一个解决方案是以这种方式遍历每个单元格:

data.get(1).get(0)  , data.get(1).get(1) , data.get(2).get(0)  ,  data.get(2).get(1) ans so on.

cucumber 是否可以自己对所有表值进行测试?

【问题讨论】:

  • 改用“场景大纲”...这会将每个用户密码组合作为单独的测试运行。

标签: automation cucumber


【解决方案1】:

正如@Grasshopper 所说,请改用Scenario Outline

Scenario Outline: Login functionality
  Given loginscreen
  When I enter Email as <Email> and Password as <Password>
  Then Login should be unsucessful
  Examples:
  | Email   | Password     |
  | xxxxxx  | mypassword   |
  | abcde   | mypassword   |

【讨论】:

    猜你喜欢
    • 2023-03-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-13
    • 2011-03-04
    相关资源
    最近更新 更多