我们希望使用外部文件(如excel表)在Cucumber中实现数据驱动测试,而不使用Cucumber提供的DataTable或Examples关键字 .
这是我的专题文件
功能:验证登录页面场景概述:使用Excel和数据集驱动数据
当我是登录页面然后我用excel row "<row_index>"
dataset输入用户名和密码
Examples:
| row_index |
| 1 |
| 2 |
| 3 |
| 4 |
在上面的例子中,我们根据文件中提供的行索引从excel读取数据 .
很难在功能文件中写入那么多记录,因为数据将被动态添加(测试的行数不会增加),我们需要每次都修改功能文件 .
is there any way to read the data from external files like excels so that we can keep test data separately from scenarios and do data driven testing.
任何指导或建议都会有很大帮助
谢谢,安吉
1 回答
如果您要使用Excel电子表格进行测试,那么使用Cucumber是没有意义的 . 而是编写一个单元测试,然后您将编写代码并使用编程语言,这样您就可以将电子表格加载到数据结构中并迭代它们来执行测试 .