我想将一些 JSON 数据导入到我的测试中。
为了记录我应该这样做:
* def data = read('classpath:init/data.json')
我已经使用以下内容创建了 JSON 文件:
{
"name": "ehsan"
}
这是我的代码:
Background:
* def data = call read('classpath:init/data.json')
Scenario:
* print data
但它什么也没打印并说:
16:11:30.898 [main] WARN com.intuit.karate - not a js function or feature file: read('classpath:init/data.json') - [type: JSON, value: com.jayway.jsonpath.internal.JsonContext@7d61eccf]
下面的代码是正确的:
* def data = read('classpath:init/data.json')
只有你必须删除[call]
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)