Testing / Karate Framework Interview questions
What is the retry until keyword used for?
retry until repeatedly executes an HTTP call (and optionally other steps) until a given condition becomes true or a configured retry limit is reached, useful for polling an endpoint whose result depends on asynchronous processing that hasn't necessarily finished by the time the first request is made.
* configure retry = { count: 10, interval: 1000 } Given url baseUrl + '/jobs/' + jobId And retry until responseStatus == 200 && response.status == 'COMPLETE' When method get Then status 200
This avoids the fragile alternative of hard-coding a fixed sleep before checking a result: retry until checks as soon as possible and only waits as long as actually necessary, up to the configured limit, which keeps tests both faster on average and more reliable against variable processing times than a fixed delay would be.
More Related questions...