如何在空手道特征中循环绕阵列值
我正在尝试在空手道功能文件中循环浏览数组值。 在功能1.feature -scenario1中,我在数组中有一些值[“ uuid1”,“ uuid2”,“ uuid3”],我想调用另一个功能文件(feature2.feature)(有代码可以调用delete Endpoint )服务功能
。Feature:
@ignore
Feature: Delete
Background:
* url baseUrl
* headers {content-type:'application/json'}
Scenario: Delete Test Assets
Given headers {uid: '#(UId)', cid:'#(CId)'}
And path 'type', Type, 'id', AssetId
When method delete
Then status 204
我应该用哪种方法来feature1.feature调用feature2.Feature循环中?
I am trying to loop over array values in a karate feature file.
In a Feature1.feature - Scenario1, I have some values in the array ["UUID1","UUID2","UUID3"] and I want to call another feature file (Feature2.feature) (having a code to call a DELETE endpoint) of a service
Feature2.feature:
@ignore
Feature: Delete
Background:
* url baseUrl
* headers {content-type:'application/json'}
Scenario: Delete Test Assets
Given headers {uid: '#(UId)', cid:'#(CId)'}
And path 'type', Type, 'id', AssetId
When method delete
Then status 204
What approach should I use to Feature1.feature to call the Feature2.feature in a loop?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您有各种原始图,则需要在执行“循环调用”之前将其转换为JSON对象。请参阅
karate.mapwithkey()
: htttps:// github.com/intuit/karate#json-transforms这样做:
in
second.feature
:当然,请阅读
Call> Call> Call
的文档,如果需要: https://github.com/intuit/karate#data-data-data-data-data-data-data-data-data-data-data-data-data-data-data-data-data-data-data-data-dr例>If you have an array of primitives, you need to convert it into an array of JSON objects before doing a "loop call". Refer to the docs for
karate.mapWithKey()
: https://github.com/intuit/karate#json-transformsSo do this:
And in
second.feature
:Of course, read the docs for
call
if needed: https://github.com/intuit/karate#data-driven-features