我们可以将 excel 文件或 .csv 文件作为空手道功能文件中的 table 输入传递吗

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

在空手道中,我们使用以下值进行参数化。我们是否可以选择将 table 作为空手道中的外部文件传递。

And table tablename
     | name | age | id |
     | abc  | 02  | 01 |
     | def  | 03  | 02 |

And def values = { "name": '(#name)', "age": '(#age)', "id" : '(#id)' }

期待以下空手道框架。

And table <tablefile.xls>
And def values = { "name": '(#name)', "age": '(#age)', "id" : '(#id)' }

有多种方法,最推荐的是使用JSON来维护测试数据。

详情请看这个回答:

编辑:由于 OP 坚持 Excel,请参阅其他详细解释的答案:

如果我是你,我不会使用 Excel,至少会使用 CSV。在我看来 tableset 比 Excel 更容易维护,您可以将其作为测试 feature 文件本身的一部分。