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

How to use a variable in JsonPath filter

Read this first: https://github.com/intuit/karate#rules-for-embedded-expressions And what you are looking for is this: https://github.com/intuit/karate#jsonpath-filters * def ids = karate.jsonPath(response, “$.kittens[?(@.name=='” + name + “‘)].id”)

Karate – editing xml while running the test case

There is something called “embedded expressions” in Karate. Read the docs: https://github.com/intuit/karate#embedded-expressions Example: * def guids = <guids><guid>one</guid><guid>two</guid></guids> * def body = <root>#(guids)</root> Also refer this file, it has a lot of other examples and ideas for XML data-driven tests: xml.feature.

Karate UI: Locating text via CSS

The reason the docs don’t talk much about CSS selectors is that it is a standard. BTW this is open source, you are welcome to contribute pull-requests to improve the documentation. UI automation is hard, I’m not going to claim that any framework makes it magically easier. Suggestions: if not already, start using the VS … Read more

Is there a simple match for objects containing array where the array content order doesn’t matter?

Use 2 contains only. Yes we haven’t designed a deep contains, it is rarely needed. * def sample = { user: [‘read’, ‘write’, ‘append’], public: [‘read’, ‘append’] } * match sample.public contains only [‘append’, ‘read’] * match sample.user contains only [‘write’, ‘read’, ‘append’] For completeness, although this may be overkill unless you want to re-use … Read more

Cannot escape url as needed

Encoding is the correct behavior: https://www.w3schools.com/tags/ref_urlencode.asp But your workaround for this un-usual URL is in Karate make it as part of the url itself: Given url ‘https://httpbin.org/https%3A%2F%2Fdomain’ When method get Then status 200

Karate Gatling – exclude specific request or feature from report [duplicate]

Currently there is no way to ignore any request. One option is to separate the auth step out and use Feeders: https://github.com/intuit/karate/tree/develop/karate-gatling#feeders If you refer the Gatling docs: https://gatling.io/docs/current/general/assertions/#scope – it may be possible to “scope” the percentile assertions to a group or name. Here is someone who seems to have had success with a … Read more