黄瓜场景大纲中的嵌套示例 - 列表或映射值 [英] Nested examples in cucumber scenario outline - List or Map values

查看:21
本文介绍了黄瓜场景大纲中的嵌套示例 - 列表或映射值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近看到一个像这样的黄瓜场景大纲.对不起我下面的坏例子.但是格式是这样的.我真的很想知道黄瓜是否支持这种格式?嵌套数据表.有没有人使用过这种类型的嵌套数据表?如果是,是以下格式吗?

I have recently seen a cucumber scenario outline like this. sorry for my bad example below. But the format is in this way. I really wonder if this type of format is supported by cucumber? The nested Data tables. Has any one used this type of nested Data table? If yes is this the below format?

        Scenario Outline: Hello World
     Given I am logged in as <user>
     When I search for <searchTerm>
     Then I add the following to my basket:
        | <item1> |teapot|
        | <item2> |Yorkshire tea|

Examples:
| user | searchTerm |
| Adam | Tea        |

我可以像上面那样做一个数据表吗

Can i make a data table like above

推荐答案

这不是他们的工作方式.

That's not quite how they work.

嵌套数据表由表连接到的步骤使用.它通常用于做多个相同的事情,将内部的数据表用作数组.这可以包括标题,也可以不包含标题 - 取决于您编写步骤的方式.记住 - 一切都是为了沟通.

The nested data tables are used by the step that the table is joined to. It's usually used to do multiple of the same thing, using the data table on the inside as an array. This can include headers, or no headers - depending on how you have written your step. Remember - it's all about communication.

举个例子:

Scenario Outline: Hello World
 Given I am logged in as <user>
 When I search for <searchTerm>
 Then I add the following to my basket:
    | <item1> |
    | <item2> |

Examples:
| user | searchTerm | item1  | item2         |
| Adam | Tea        | teapot | Yorkshire tea |

这篇关于黄瓜场景大纲中的嵌套示例 - 列表或映射值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆