黄瓜方案大纲中的嵌套示例-列表或地图值 [英] Nested examples in cucumber scenario outline - List or Map values

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

问题描述

我最近看到了一个类似这样的黄瓜方案.对不起,我下面的错误示例.但是格式是这样的.我真的想知道黄瓜是否支持这种格式?嵌套的数据表.有没有人使用过这种类型的嵌套数据表?如果是,是下面的格式吗?

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天全站免登陆