1

Refer https://karatelabs.github.io/karate/#loops

Here

* def fun = function(i){ return i * 2 }
* def foo = karate.repeat(5, fun)
* match foo == [1, 1, 1, 6, 8]

'foo' when mismatches with the first element, karate stops to match rest of the elements What can be used here so as to compare all elements of two lists (index wise) enter image description here

Manish Arya
  • 113
  • 1
  • 7
  • 1
    yes, karate will stop on the first failure. you are welcome to contribute code to improve karate. that said, maybe this answer will help: https://stackoverflow.com/a/54108755/143475 - and please note that things like `match contains` exist for similar use cases – Peter Thomas Dec 25 '22 at 18:59
  • @PeterThomas Thanks for information ! for now I have handle it using Java code – Manish Arya Dec 28 '22 at 04:41
  • @PeterThomas I don't think this question should be marked as duplicate as in the ref link given by you deals with JSON but I what I am trying to do is to match match values in two lists index-wise. match contains won't do that – Manish Arya Dec 28 '22 at 19:17
  • please assume that there is no built in way in karate to do that. it is actually possible if you write a loop or if you use `karate.sort()`: https://stackoverflow.com/a/52932601/143475 – Peter Thomas Dec 29 '22 at 02:28

0 Answers0