Santoshsarma
Santoshsarma

Reputation: 5667

How to iterate list of params through separate feature file?

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'

Upvotes: 2

Views: 108

Answers (1)

Babu Sekaran
Babu Sekaran

Reputation: 4239

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

Upvotes: 2

Related Questions