0
  • def json = response.data.result
  • def condition = function(x){ return x.transaction != " " }
  • def TransactionList = karate.filter(json, condition)

I am taking the list of transactions from an array in the response excluding blank values. The list returns ["cash","POS","digital"]. Then I the hit the api with below steps

Given path 'api/transactiondata/transaction'
* set InputForSearch.search.search_text =  TransactionList[0]
And request InputForSearch




 The response is dynamic, so sometime the list will be empty. 
If the list is 0, I dont want the above steps to executed and skip to the next line in my script.
 I have to do similar validations for other fields in the same feature file.

Any help is much appreciated.

0 Answers0