Karate 多部分文件不使用变量作为文件名
我试图将多部分文件作为变量使用,我的特性如下所示Karate 多部分文件不使用变量作为文件名,karate,Karate,我试图将多部分文件作为变量使用,我的特性如下所示 Feature: Test feature Background: * def JavaUtil = Java.type('com.intuit.karate.demo.util.JavaUtil') * def file = JavaUtil.createBatchFile("1003"); # Scenario: test one # * print " this is the first test: " * ur
Feature: Test feature
Background:
* def JavaUtil = Java.type('com.intuit.karate.demo.util.JavaUtil')
* def file = JavaUtil.createBatchFile("1003");
# Scenario: test one
# * print " this is the first test: "
* url appUrl + '/api/partner/v1/bulk/'
* print 'file :', file
Given path 'jobs', jobId, 'batches'
And multipart file newBatchInfo = { read: file}
When method post
Then status 200
当代码执行时,文件具有正确的值,但多部分文件不接受具有绝对路径的文件变量
这是正确的用法吗?如果有关于这个的文件,有人能告诉我吗。谢谢
这是我的输出
有一个
文件:
前缀,您可以在生成文件的情况下使用它。我建议您在使用Maven时将文件生成到target
,例如
参考文件:
还请注意,您应该使用:
* def file = 'file:' + JavaUtil.createBatchFile("1003")
# ...
* And multipart file newBatchInfo = { read: '#(file)' }