我们可以将Excel文件或.csv文件作为表格输入传递到空手道特征文件中吗 [英] Can we pass the excel file or .csv file as a table input in karate feature file
问题描述
在空手道中,我们使用以下值进行参数设置.我们是否可以选择将表作为空手道中的外部文件进行传递.
In Karate, we are parameterizing with the below values. Do we have any option of passing the table as external file in karate.
And table tablename
| name | age | id |
| abc | 02 | 01 |
| def | 03 | 02 |
And def values = { "name": '(#name)', "age": '(#age)', "id" : '(#id)' }
在空手道框架中期待以下内容.
Expecting below in karate framework.
And table <tablefile.xls>
And def values = { "name": '(#name)', "age": '(#age)', "id" : '(#id)' }
推荐答案
有多种方法,最推荐的方法是使用JSON维护测试数据.
There are multiple ways, the most recommended is to use JSON for maintaining test data.
请查看以下答案以获取详细信息: https://stackoverflow.com/a/49031155/143475
Please take a look at this answer for details: https://stackoverflow.com/a/49031155/143475
由于OP坚持使用Excel,因此请参考此详细解释的其他答案: https://stackoverflow .com/a/47954946/143475
Since OP is insisting on Excel, please refer to this other answer where this is explained in detail: https://stackoverflow.com/a/47954946/143475
如果您是我,我将不会使用Excel,至少会使用CSV.我认为table
或set
比Excel易于维护,您可以将其作为测试feature
文件本身的一部分.
If I were you I would NOT use Excel and at least use CSV. In my opinion table
or set
is far easier to maintain than Excel and you can do it as part of your test feature
file itself.
这篇关于我们可以将Excel文件或.csv文件作为表格输入传递到空手道特征文件中吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!