如何通过单独的功能文件迭代参数列表? [英] How to iterate list of params through separate feature file?
本文介绍了如何通过单独的功能文件迭代参数列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何通过传递ID列表来对此进行迭代.我在foo变量中有多个ID,我想为该foo变量中的每个ID调用 delete_project.feature .
project.feature
* def foo = get response.data[*].id
* def del = call read('delete_project.feature')
delete_project.feature
Given path 'project', id
When method DELETE
Then status 200
Then match response.status == 'success'
解决方案
通过传递ID列表作为功能的输入,您实际上可以多次进行调用迭代功能.
* def foo = get response.data[*].id
* def createId = function(x) {return {"id" :x}}
* def ids = karate.map(foo,createId)
* def del = call read('delete_project.feature') ids
在空手道中引用数据驱动功能
How to iterate this by passing a list of ids. I've multiple ids in foo variable, I would like call delete_project.feature for each id available in that foo variable.
project.feature
* def foo = get response.data[*].id
* def del = call read('delete_project.feature')
delete_project.feature
Given path 'project', id
When method DELETE
Then status 200
Then match response.status == 'success'
解决方案
By passing list of id's as a input to your feature you can actually make the call iterate feature that many times.
* def foo = get response.data[*].id
* def createId = function(x) {return {"id" :x}}
* def ids = karate.map(foo,createId)
* def del = call read('delete_project.feature') ids
Refer data driven feature in karate
这篇关于如何通过单独的功能文件迭代参数列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文