Now I have a problem. Assume that before I request the A interface, I need to request the B interface and decide whether it needs to request the A interface based on whether the value returned by the B interface is null. How do I do this in karate? I read the document do not know if eval can meet my needs?
like this
`
@nuanyang233 anything is possible, please read this answer on Stack Overflow: https://stackoverflow.com/a/50350442/143475
the last line can be * eval if (condition) karate.call('some.feature')
Thank you, I still have a question. Does karate have shortcuts to help me get to the last element when using get to fetch elements from an array?
yes. actually this is easy in JsonPath: https://stackoverflow.com/a/45029709/143475
Also read the karate docs.
* def list = [1, 2, 3, 4]
* def last = get[0] list[-1:]
* match last == 4
you can also use JS
* def list = [1, 2, 3, 4]
* def last = list[list.length-1]
* match last == 4
I think I fell in love with karate
Most helpful comment
I think I fell in love with karate