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
3
votes
1 answer

How to Filter by a JSON Key Value Where the Key is Nested at Various Depths?

I have a large JSON response where I only need to update certain fields. Want to filter down the response, but the key/value pair I'm interested in is nested at varying levels. I tried to use the jsonpath .. notation to find it. * eval var…
anutter
  • 366
  • 2
  • 17
3
votes
2 answers

Karate combine retry until and compareImage

I want to test if a fetched thumbnail is correct. It might not correct the first time, so I want to retry every couple of seconds. That's why I want to combine retry until and compareImage. Is there any way to achieve this? This is what I currently…
3
votes
0 answers

java.lang.NoClassDefFoundError: org/apache/maven/surefire/api/testset/TestSetFailedException while running Junit5

While running the Junit 5 test cases facing the below issue. CMD: $ mvn test -Dtest=com.app.AppTest -DskipTests=false (run only a specific test file, based on need and Jdk 1.8.0_232 with apache-maven-3.8.6 ) Error: [INFO] ---…
3
votes
1 answer

karate UI webSockets : getting invalid handshake response getStatus: 403 Forbidden

A day back my scripts were working just fine,but all of a sudden I started getting this error when I launched the scripts today.Can someone help me with this ? [main] ERROR com.intuit.karate - driver config / start failed:…
3
votes
1 answer

how to define order for execution of feature files in karate framework

I have few feature files in specific subfolders, And I want to execute those feature files according to my defined order. So how can we run the feature files in a specific order? Thank you in Advance!
3
votes
0 answers

How many rows of data can karate "read(file.csv)" can read?

I am trying to read and print the data from a csv file using below karate scenario outline code snippet. the CSV file contains more than 350 rows of data with 2 columns "Description" and "Expression". But when I execute the below code snippet its…
Kundan Balse
  • 103
  • 1
  • 4
3
votes
0 answers

How to share karate html reports to others without sending as zip. If only html single file is sent then it shows as plain file

I am using cucumber report with karate using the masterthought dependency. When the cucumber report is generated and if I want to share it to other I have to make a zip folder containing all the css, js etc folders along with the html file. If I…
3
votes
1 answer

Karate UI Automation - driver.inputFile not working with ChromeWebDriver

I am working on an automation project that requires a file upload using Karate UI. Me and my team tried a few alternatives and using driver.inputFile() seemed to work just fine. However, we also run tests on headless mode with Browserstack, where we…
JVRD27
  • 31
  • 2
3
votes
1 answer

Accessing java script files from outside the classpath in a karate-config.js file

I have a util file that I need to access called util.js from karate-config.js and would like it available for both modules to use. util.js module1 -- src --- test --- java ---- karate-config.js module2 -- src --- test --- java ----…
3
votes
1 answer

Defining two o more functions in karate-config.js

My karate-config.js is: function config(){ return karate.read('classpath:' + env_file()); } function env_file(){ var env_file = karate.env; if(!env_file){ env_file = 'local.yml'; } return 'env/' + env_file; } That was…
italktothewind
  • 1,950
  • 2
  • 28
  • 55
3
votes
1 answer

Karate Framework - How to use declared variables as parameters of request object?

First of all, sorry if I'm asking something obvious as I don't come from a programming background, there I go: I'd like to run a series of test Scenarios and have declared couple variables in the Background part (I have print them to double check…
rixoto
  • 33
  • 1
  • 6
3
votes
0 answers

how to upload a file with karate?

I know the question has already been asked, but I’m having trouble uploading a file with karate. I have a file called "example.pdf" in my project. I put this document in a "assets" folder I tried to build on the example of the documentation…
Olivier
  • 343
  • 2
  • 16
3
votes
1 answer

Selenium / Java : How to write element locator for an element with aria-selected=false

We are unable to locate and click at an element with "aria-selected" = "false" on an HTML page. We have tried different way to write xpath locator and css selector but none of them worked. While inspecting a bit more on page, we found that this…
Niks
  • 85
  • 6
3
votes
1 answer

How to check a particular value on basis of condition in karate

Goal: Match the check value is correct for 123S and 123O response in API First check the value on this location x.details[0].user.school.name[0].codeable.text if it is 123S then check if x.details[0].data.check value is abc Then check if the value…
Maddy
  • 674
  • 1
  • 7
  • 26
3
votes
1 answer

Replace Json key in Karate

I need to send a Json to an endpoint but I need to replace a key with a variable. I've this code ..... * def idJson = response.id Given path And headers {Authorization: '#(auth)'} And request read('classpath:myjson.json') …
mdotb
  • 33
  • 3