在黄瓜表中生成动态数据 [英] Generate Dynamic data in cucumber table

查看:79
本文介绍了在黄瓜表中生成动态数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在黄瓜表中生成动态数据:

Hi I want to generate dynamic data in the cucumber tables:

Feature: Generate dynamic data

 Scenario Outline:
 
  When open url

  Then get the price list and save to "Price List" in context 

  #Note: Price list is an array and returned as [10, 20, 30, 40] and this is dynamic

  When send "<singlepricelist" to server

  .......the remaining steps....

 Examples:

 | singlepricelist |

 | <<Price List   |

问题:在步骤何时发送"中,我想一一发送数组列表中存在的值,即该示例在该示例中应使用值10、20、30和40运行4次

Question: In the step "When send "", I want to send the values present in arraylist one by one i.e. the said step in this example should run 4 times with the values 10, 20, 30 and 40.

我可以在示例中生成动态数据,以使上述步骤运行4次吗?注意:singlepricelist一次只能取一个值.

Can I generate the dynamic data in the Examples so that the above step will run 4 times? Note: singlepricelist can take only one value at a time.

先谢谢了!

推荐答案

首先,您不能使用功能部件文件进行任何编程.因此,您无法从功能文件传递动态值.

First of all, you cannot use the feature file to do any programming. So you cannot pass dynamic values from the feature file.

如果要使用列出的值(10、20、30和40)执行上述方案,则可以将每个值作为示例添加.

If you want to perform the above scenario with the listed values (10, 20, 30 and 40), you can add each of them as an example.

如果希望值是动态/随机的,则可以在步骤定义中实现.在这种情况下,您可以从步骤定义的实现中生成它们,而不是从功能文件发送值.在那种情况下,我不明白您为什么要运行4次.

If you want the values to be dynamic / random, you can implement this in your step definition. In that case, rather than sending the values from your feature file, you would generate them in the implementation of your step definition. In that case I don't understand why you would want to run it 4 times.

说实话,我从问题中无法理解您的用例.您能解释一下要发送4个动态值的原因吗?(您要解决的问题是什么?)

To be honest, I don't understand your use case from the question. Can you explain the reason you want to send 4 dynamic values? (what is the problem you are trying to solve with this?)

这篇关于在黄瓜表中生成动态数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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