有没有办法在一系列动态生成的数据上多次运行黄瓜方案? [英] Is there a way to run a cucumber scenario multiple times over a list of dynamically generated data?

查看:432
本文介绍了有没有办法在一系列动态生成的数据上多次运行黄瓜方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我有一个驻留在数据库中并每天更新的产品的ID列表。我需要能够运行一个使用该数据并按顺序对每个id运行相同步骤的方案。但是,测试不应停止,因为其中一个ID在方案中失败了,这类似于黄瓜对方案大纲类型的测试所做的事情。

For example, I have a list of ids for a product that lives in a database and is updated daily. I need to be able to run a scenario that consumes that data and runs the same steps over each of the ids in order. However, the test should not stop because one of the ids failed in the scenario, similar to what cucumber does with the scenario outline type of tests.

我们还希望对黄瓜测试的输出进行格式化,以便每个id的格式都像是场景大纲中的单独测试或示例一样。 。

We would also want to format the output of the cucumber test(s) so that each id is formatted as if it is a separate test or example in a "scenario outline."

推荐答案

黄瓜不用于在功能文件
中写入复杂的信息,如果您的数据很复杂,或者如果动态生成,您应该在步骤定义中获取数据,并在特征文件中编写一个通用术语。

Cucumber is not designed to write complex information in feature file , If your Data is complex , or dynamically generated , you should get Data in step definition and write a generic term in feature file .

这就是黄瓜的目的,编写简单的功能,以便非技术人员可以轻松理解该方案的工作。

That's the intention of cucumber , writing simple features so that non technical person can easily understand what the scenario is doing.

这篇关于有没有办法在一系列动态生成的数据上多次运行黄瓜方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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