如何对具有多个场景的特征文件使用相同的哈希图
我有一个案例,我有带有 3 个示例的黄瓜场景大纲,每个示例都生成一些我需要将其存储在哈希图中的数据。例如 -
Example1 generates- acct no.- abc
Example 2 generates - acct no. - def
Exmaple 3 generates - acct no. - ghi
我想将其存储为 acct[0]-abc、acc[1]-def、acc[2]-ghi
现在如果使用 map.put 它会覆盖第一个值。请帮助我如何继续附加哈希图或如何在所有三个示例中使用相同的映射。
我尝试使用 map.put ,它覆盖了第一个值
I have a case where I have cucumber scenario outline with 3 examples and each example is generating some data which I need to store it in hashmap. For example-
Example1 generates- acct no.- abc
Example 2 generates - acct no. - def
Exmaple 3 generates - acct no. - ghi
I want to store it like acct[0]-abc, acc[1]-def, acc[2]-ghi
Right now if use map.put it overrides the first value. Please help me that how to keep on appending the hashmap or ow to use the same map for all three examples.
I tried using map.put and its oveerides the first value
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
场景大纲只是编写多个单一场景的“快速”方式。由于每个场景都在其自己的上下文中独立运行,因此您无法将所有场景的结果放入一个数据结构中。
您的数据结构不会被覆盖,它会在场景结束时被丢弃,并在下一个场景开始时重新创建。
您必须编写一个场景(没有大纲)才能完成您所描述的操作。
A scenario outline is just a 'quick' way of writing several single scenarios. As each scenario runs independently and in its own context you can't get the results of all your scenarios into one data structure.
Your data structure isn't being overwritten its being discarded as the scenario ends and recreated as the next scenario starts.
You would have to write a single scenario (no outline) to be able to do what you describe.