How to prepare a nested data structure for a data-driven test in Karate?

I don’t recommend nesting unless absolutely necessary. You may be able to “flatten” your permutations into a single table, something like this: https://github.com/intuit/karate/issues/661#issue-402624580 That said, look out for the alternate option to Examples: which just might work for your case: https://github.com/intuit/karate#data-driven-features EDIT: In version 1.3.0, a new @setup life cycle was introduced that changes the … Read more

How to rerun failed features in karate?

Here is my reusable implementation using karate-1.0#retry-framework-experimental, Results retryFailedTests(Results results) { System.out.println(“======== Retrying failed tests ========”); Results initialResults = results; List<ScenarioResult> retryResult = results.getScenarioResults().filter(ScenarioResult::isFailed) .parallel() .map(scenarioResult -> initialResults.getSuite().retryScenario(scenarioResult.getScenario())) .collect(Collectors.toList()); for (ScenarioResult scenarioResult : retryResult) { results = results.getSuite().updateResults(scenarioResult); } return results; } This java function takes care of retrying failed scenarios in parallel. You can … Read more

Karate – Setting global request headers

Ignore callSingle for now and focus on configure headers. I think you are missing one step – which is to ensure that configure headers has been “applied” before each Scenario. If you are 100% sure that this applies “globally”, just do this in karate-config.js: karate.configure(‘headers’, { Accept: ‘application/json’ }); Else you use the Background (in … Read more

Can you use wildcard characters with tags to get all matching tags

Yes. First read this – there is this un-documented expression-language (based on JS) for advanced tag selction based on the @key=val1,val2 form: https://stackoverflow.com/a/67219165/143475 So you should be able to do this: valuesFor(‘@jira’).isPresent And even (here s will be a string, on which you can even do JS regex if you know how): valuesFor(‘@jira’).isEach(s => s.startsWith(‘CIS-‘)) … Read more

Handling JWT bearer token from ADFS

Certificate support made it into 0.7.0 and you can find examples here: https://github.com/intuit/karate/tree/master/karate-demo/src/test/java/ssl Hope that gets you on your way, else you may need to dig into this long thread on SSL / Cert support in Karate and perhaps add a feature request: https://github.com/intuit/karate/issues/281 One idea is if you can modify your .NET program to … Read more

tech