How to iterate list of params through separate feature file?

一个人想着一个人 提交于 2019-12-11 01:27:08

问题


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'

回答1:


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



来源:https://stackoverflow.com/questions/55016948/how-to-iterate-list-of-params-through-separate-feature-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!