Questions tagged [karate]

Use for questions regarding Karate, an open-source tool that combines API test-automation, mocks, performance-testing and UI automation - into a single, unified framework.

Karate is the only open-source tool that combines API test-automation, mocks, performance-testing and UI automation into a single, unified framework.

Karate uses a language-neutral BDD syntax, which is easy for even non-programmers. Besides powerful JSON & XML assertions, you can run tests in parallel for speed - which is critical for HTTP API testing.

You can easily build (or re-use) complex request payloads, and dynamically construct more requests from response data. The payload and schema validation engine can perform a 'smart compare' (deep-equals) of two JSON or XML documents, and you can even ignore dynamic values where needed.

Test execution and report generation feels like any standard Java project. But there's also a stand-alone executable for teams that are not comfortable with Java. Just write tests in a simple, readable syntax - carefully designed for HTTP, JSON, GraphQL and XML.

4221 questions
1
vote
1 answer

Getting error in Karate V1.1.0 org.graalvm.polyglot.PolyglotException: TypeError: invokeMember (add) on [] failed due to: Message not supported

I was using Karate v0.9.6 all this while. Recently I have upgraded to the version 1.1.0 One thing is troubling a lot is as bellows, * def responsevalue = response.body * def length = responsevalue.length * def number = [] * eval for(var i = 0;i <…
oliver
  • 75
  • 6
1
vote
0 answers

Karate: Validate JSON response variable is null or greater than today's date

JSON response is as below { "totalElements": 3, "content": [ { "goal": [ { "id": "911", "subject": { "reference": "Patient/01051992H", …
Hema Latha
  • 85
  • 1
  • 3
  • 12
1
vote
0 answers

Is there any way to handle exceptions in karate?

Is there any way to handle the exceptions in karate during test execution? For example, If a run a feature file and I get an exception in between the script. Is there a logic I can write to catch that exception.
1
vote
1 answer

Karate - Results from two series of tests aren't merged anymore after upgrading version from 0.9.3 to 1.2.0

We are facing an issue related to the tests results after upgrading our Karate project from V0.9.3 to V1.2.0. We are testing an API after the execution of two batchs. Therefore we have a first series of tests (Runner 1) executed on our API after our…
Alexis G.
  • 13
  • 2
1
vote
2 answers

How to create Karate test to verify the WSDL file

I'd like to ensure my WSDL contract is unchanged but matching on its response to a file Scenario: Get demo.wsdl Given path '/demo' And param wsdl = 'demoLookup.wsdl' When method get Then status 200 # note how we focus only on…
1
vote
0 answers

Facing this issue "Missing property in path $['frameTree']['childFrames']" while switching to an iframe which is a tokenex iframe

Given driver redirectUrl And waitForText('body', 'Información de la tarjeta de crédito') And driver.maximize() And driver.screenshotFull() And waitFor("//*[@id='mat-input-0']") And input("//*[@id='mat-input-0']", '12/22') And…
M.Rishitha
  • 11
  • 1
1
vote
1 answer

"ErrorMessage" : "Requested media type is not allowed, please verify the media type and resubmit the request"

"ErrorMessage" : "Requested media type is not allowed, please verify the media type and resubmit the request", By default it is adding in charset=UTF-8 along with application/x-www-form-urlencoded; header 1 > Content-type:…
1
vote
0 answers

How to remove header from global karate-config.js file file

I have written this code(see below) to set global headers value in karate-config.js file so that i don't need to write again and again in any feature file. That part is working fine. But i want to remove one set of key value pair from my headers so…
1
vote
1 answer

Karate comparing 2 arrays of numbers

I am getting one array from an API response and the second is a list of calculated values. I would want to match both arrays but the values could be slightly different due to rounding, so I'd like to do something like this Values of array 1 included…
I. Tennant
  • 119
  • 8
1
vote
1 answer

Access JSONPath firstLevel sons

So, I have this answer I want to extract, among other things, the subjects, to test against other answers. { "subject": { "pe": { "total": 23, "passed": 2, "failed": 1, }, "maths": { "total": 23, "passed":…
ColdDevil
  • 23
  • 5
1
vote
0 answers

Customized json report for karate framework

can I customize generated JSON reports in a different format for our specific purposes like for qtest which accepts JSON reports in particular formats?
1
vote
1 answer

In Scenario outline how to set the the limitation for reading the data from the csv files

Consider the below example Feature: scenario outline using a dynamic table from a csv file Scenario Outline: cat name: Given url demoBaseUrl And path 'cats' And request { name: '#(name)', age: '#(age)' } When method post Then status 200 And match…
1
vote
0 answers

Dynamic test tag pattern execution in karate

i have to run selected tests in karate using test runner and tags, apart from using the method like this- tags("SMOKE", "Regression"), can we have an alternative in java where the tags can be dynamically executed instead of manually using the tags…
1
vote
0 answers

Karate DSL - $.embedded_json_message | data types don't match (OTHER:MAP) when read from separate json file

I have a scenario where I'm retrieving rows of data from a Postgres DB table and matching the corresponding column output against a separate .json file. The db.readRow() Java Util method returns a Map. The column in question that's…
1
vote
0 answers

In mocks - Karate is throwing com.intuit.karate.core.ScriptBridge.xmlPath(ScriptBridge.java:421) null pointer exception in the xml body path matches

In mock, I have one scenario : I have passed xml bodypath like this only earlier it worked, now it is giving me error Scenario: pathMatches('/some/end/point/v8') && methodIs('POST') && bodyPath('/xml/path/values/text()') == "4000758341" &&…