Can we pass the excel file or .csv file as a table input in karate feature file

倖福魔咒の 提交于 2019-12-11 09:43:25

问题


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)' }

回答1:


There are multiple ways, the most recommended is to use JSON for maintaining test data.

Please take a look at this answer for details: https://stackoverflow.com/a/49031155/143475

EDIT: Since OP is insisting on Excel, please refer to this other answer where this is explained in detail: https://stackoverflow.com/a/47954946/143475

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.



来源:https://stackoverflow.com/questions/49692779/can-we-pass-the-excel-file-or-csv-file-as-a-table-input-in-karate-feature-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!