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 verify if all the items in 1 json is available from karate's response data

I have a JSON file which I am reading in Karate feature file which consists of IDs, something like below temp.json { 112354, 221344, 126789, 122333 } In my Karate feature file, I am calling an API that returns all the IDs available in the…
3
votes
1 answer

Can I disable the 'thymeleaf' report from the karate log

Is there any way to enable and disable the thymeleaf report from the logs? I couldn't find any config flag to do, so is there any other way to switch it on/off?
3
votes
1 answer

Karate set token in local storage

I can set some value in local storage with following script script("sessionStorage.setItem('foo', 'bar')") But I need to set item passing a parameter. For example, save response token from a api call def token = response.token Now I would like…
3
votes
4 answers

Get frequent chrome driver error: driver config / start failed: chrome server returned empty list from http://localhost:(port) in karate standalone

I used to get frequent chrome driver error in karate UI tests. I have been using karate tests in VS code for the past 5 months. Now, I used to get driver config / start failed: chrome server returned empty list from http://localhost:[port]…
3
votes
2 answers

Karate Robot: Not able to click button using image

I am using Karate robot for clicking a button using image. Below is my code: robot { app: '^Chrome', highlight: true } robot.input('OracleDriver') delay(2000) robot.click('delete.png') Sometimes I am able to click delete button for delete.png but…
3
votes
1 answer

Need to store attribute values of a table for assertion in Karate

I have a case where locator doesn't have a text value but it's attribute named title has a text value that I need to assert. While writing custom locator for it I can only get the text value which is "" and not specific attribute value say title =…
Uncle Sam
  • 255
  • 3
  • 11
3
votes
1 answer

Karate summary reports not showing all tested features after upgrade to 1.0.0

I have recently upgraded to version 1.0.0 from 0.9.6 and noticed that the generated karate-summary.html file, it doesn't display all the tested feature files in the JUnit 5 Runner unlike in 0.9.6. What it displays instead was the last tested feature…
jjeoneun
  • 346
  • 5
  • 16
3
votes
3 answers

Can I use karate for testing microservices?

Let me give some background. We're trying to do e2e testing between a bunch of spring boot services that write to kafka, move files and talk to other services to do the file moving. I think we're pretty good on integration testing with mocks and…
Sarah Kazi
  • 71
  • 6
3
votes
1 answer

In Karate, what is the advantage of wrapping a Java function in a JavaScript function?

I can wrap a Java function like this: * def myJavaMethod = """ function() { var Utils = Java.type('Utils'); // use Number type in constructor var obj = new Utils(...); return obj.myJavaMethod(); } """ But why would I? I can use…
user2943111
  • 421
  • 1
  • 5
  • 15
3
votes
1 answer

How to handle requests with signatures on karate tests?

First of all, thanks for build karate it's a very useful for test API's and UI's. We are using it to test a lot of our endpoints but we would like to know if there is a way or which is the best approach to handle requests with signature as part of…
3
votes
1 answer

KARATE: print statement doesn't write to console with log4j2

I have spring boot application and use karate for testing. I used log4j2 for logging. Karate use logback as a log library. I found this link for basic configuration of log4j2 with karate. But unfortunately print statement in the feature file is not…
mfe
  • 1,158
  • 10
  • 15
3
votes
1 answer

ShadowRoot dom elements access issue in Karate UI

I am trying to access ShadowRoot dom tree elements, but the problem I face is I cannot use the Specific html element to call on .ShadowRoot, as that element is dynamic (see below html snippet id="vaadin-text-field-error-0). So only way I can do is…
sandy
  • 55
  • 6
3
votes
1 answer

How to find dynamic key values in Karate?

I am hitting JIRA API to fetch cycle id based on cycle name API : http://localhost:8080/rest/zapi/latest/cycle?projectId=78654&versionId=123 and I am getting following response: { "1345": { "totalExecutions": 0, "endDate": "", …
Karan
  • 33
  • 3
3
votes
1 answer

How to execute bash script using karate and fail if script fails

I'm trying to execute bash script using karate. I'm able to execute the script from karate-config.js and also from .feature file. I'm also able to pass the arguments to the script. The problem is, that if the script fails (exits with something else…
3
votes
2 answers

Karate - custom assertion in expected JSON schema

I'm looking to perform custom assertions on fields in JSON loaded from file. I understand that we have fuzzy matching, but I'd like to perform something more custom e.g. have a function which parses a date as a LocalDateTime: public class DateUtil…