This is not supported currently. It may be there in the next version but no guarantees. Some people consider re-tries to be bad testing practice, look it up.
But here is a possible workaround. If you can move your “flaky flow” into a feature (which should be the case already) you can call it via a “wrapper feature” and a JS function. Which can be enhanced to easily take arguments for the feature to call and number of re-tries. Here we make use of JS try-catch blocks.
* def fun =
"""
function() {
for (var i = 0; i < 3; i++) {
try {
karate.call('flaky.feature');
karate.log('*** call success !')
return;
} catch (e) {
karate.log('try failed:', i, e);
}
}
karate.fail('test failed after retries: ' + i); // karate.fail('message') is only in 0.9.6 onwards, you can also [throw 'message']
}
"""
* fun()
We will not support re-using a driver across multiple Scenario
-s unless it is a called
feature. See the comments here: callSingle for login in karate-config.js does not work as expected for Karate UI tests
Remember, Karate is open-source. Please consider contributing code if these are such high-priority features for you.
EDIT - also see: https://stackoverflow.com/a/66773839/143475