1

Given a response like this:

{
  "list" : [ { "field1" : "value1"}, { "field1" : "value2"}, { "field1" : "value3"} ]
}

I need to assert in retry until that list contains at least { "field1" : "value1"} and { "field1" : "value2"}

Unfortunately all Karate nice stuff like match cannot be used in retry until and I don't know how to do it in JS (in fact, I don't know which JS is used there, what features supports, what .js scripts are in context, etc)

PD: I can't assert that condition in Then because, since the response will change across time, I really need the polling feature.

Thanks in advance.

italktothewind
  • 1,950
  • 2
  • 28
  • 55
  • this is a duplicate. if you are not able to figure this out with the information so thoroughly documented in that answer - please use some other framework, karate may not be a good fit for you. thanks. – Peter Thomas Apr 28 '19 at 06:48
  • I don't think that is the same question. In this question I'm asking how to do something in the JS that Karate supports (I don't know what is supported and what is unsupported) and in the other question I was trying to figure out how 'retry until' expression was expected to work (I though that predicates can be written like in Then clauses, which makes a lot of sense for framework users). – italktothewind Apr 28 '19 at 07:09
  • you clearly haven't read the answer properly then. you CAN use karate.match() in JS. try again, or wait for someone else to help you – Peter Thomas Apr 28 '19 at 07:10
  • I read the answer to the other question (that was edited a few minutes ago) and I understand it, I just was explaining why I think that this question is not a duplicate. I like your framework and I'm trying to understand it, unluckily I have to ask for some things like JS features supported because I don't know the implementation details. Thanks for your help. – italktothewind Apr 28 '19 at 07:19
  • yes I edited it with extra info - because I intend for it to be the reference I will point people to from the documentation. personally I feel it should answer the questions on JS. you can help by pointing out what is missing. but from what I've seen from your questions, this level of JS is too much for you to understand – Peter Thomas Apr 28 '19 at 07:21
  • Well... I'm in a Java/Scala project and I want to avoid JS. If I have to write a JS complex function for a test I would probably discard all the framework and do it directly in Java/Scala, or chose another framework with the proper DSL. – italktothewind Apr 28 '19 at 07:30
  • and if you read the documentation - you would have seen that we recommend sticking to Java: https://github.com/intuit/karate#multiple-functions-in-one-file – Peter Thomas Apr 28 '19 at 07:31

0 Answers0