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
5
votes
2 answers

Karate Runner hangs at waiting for parallel features to complete

I am trying to execute some tests using Karate Runner - @KarateOptions(tags = {"~@ignore"}) //@KarateOptions(features = "examples/test.feature") public class KarateTestRunner { @BeforeClass public static void beforeClass() throws Exception…
ysn
  • 145
  • 2
  • 13
5
votes
2 answers

karate-gatling: how to resolve java heap space OutOfMemoryError?

Currently I'm trying to run our functional tests (about 300 requests) with 10 users in parallel using gatling-plugin mvn clean test-compile gatling:test -Dkarate.env=test with the following .mvn/jvm.config local maven options in the project…
beloyar
  • 247
  • 3
  • 11
5
votes
2 answers

In karate While trying to define a variable getting "no step-definition method match found for: def referenceId= response.referenceId"

On trying to store a value from response in a variable ,to use it for the next post call and facing "no step-definition method match found for: def referenceId= response.referenceId" this error. Feature: To test GET /leads/{id} API # To generate…
Praveen Kumar
  • 123
  • 1
  • 7
5
votes
1 answer

Create tests jar with all the Karate dependencies

I have the following project structure. src/test/java There is no src/main folder. Above src/test/java folder contains some scala classes as well as some java classes. When i build the jar file using following plugins maven-jar-plugin : it…
5
votes
1 answer

[karate][standalone] Error : could not find or read file

I am only using the latest standalone karate jar to test my API on a docker container configured with JRE and I don't have any Java code. Currently on one of my features, i have this : read('file.json'), and it works fine when the resource file is…
rfjg
  • 115
  • 2
  • 8
5
votes
1 answer

Karate - Match two dynamic responses

I have to compare my WebService response with its downstream service. But, the IDs in my response and downstream response are not identical. I am giving sample responses below. And again, one is a REST service and another SOAP service, however i can…
sn1693
  • 271
  • 2
  • 21
5
votes
1 answer

Using environment variables in Karate DSL testing

I'd like to incorporate GitLab CI into my Karate testing. I'd like to loop through my tests with different user names and passwords to ensure our API endpoints are responding correctly to different users. With that in mind, I'd like to be able to…
drew2
  • 87
  • 1
  • 1
  • 9
5
votes
1 answer

How to implement Basic Auth using Karate?

I saw details about Oauth 2 in Karate Demo , Can you also provide how to implement Basic Auth ?
Sourabh Chapali
  • 361
  • 2
  • 7
  • 18
5
votes
2 answers

Retry mechanism in karate testing framework

Retry mechanism in karate testing framework How to retry tests on failure in karate testing framework like Junit and TestNG. something like public class Retry implements IRetryAnalyzer { private int count = 0; private static int maxTry =…
Rahul R
  • 125
  • 3
  • 7
5
votes
1 answer

How to set global header for all feature files in Karate API

I need to post a request to get an authorization token and include it in the header for all subsequent test requests. This token changes every time but it is valid for the entire test session as long as I keep sending requests. In each feature…
user9132922
5
votes
1 answer

Karate - How to delay all scenarios?

I have a 10 scenarios, all of them must have 1 min delay after executing background. I call my delay function in background. The problem is that all scenarios call background, and I have to wait 10 minutes. Is there a way to call my wait function…
ehsan shirzadi
  • 4,709
  • 16
  • 69
  • 112
5
votes
1 answer

Is there a mechanism for integration testing JAX-RS services without deploying (a la MockMVC)?

I have successfully built no-deployment-needed integration test frameworks for Spring MVC REST services using Mock MVC. I am struggling to do the same with JAX-RS services. REST Assured looks promising, but it seems to require deployment. The test…
4
votes
1 answer

Karate - How to use sleep for scenarios?

I have scenario when i need to use sleep. But when I run this function I get ERROR. It working previously, but I didn't run this test long time ago and when I run this test again I get this error. This is one of my scenarios: Scenario: test sleep …
Starter
  • 41
  • 1
  • 3
4
votes
1 answer

Getting `org.graalvm.polyglot.PolyglotException: ReferenceError:` - after upgrading to karate 1.1.0.RC3 from karate 0.9.5

Description : Getting reference error message after upgrading to karate 1.1.0.RC3 Steps: Execute the test.feature file test.feature Scenario: Get custom request * def testUtils = call read('classpath:features/utils.feature') * def…
naveenkrao
  • 41
  • 1
  • 3
4
votes
1 answer

How to get REST response size in Karate?

In Karate framework using Visual studio, I am making a REST call. I need to get the response size in KB or MB. I tried these: print response.size Response: [jdk.dynalink.beans.SimpleDynamicMethod int java.util.HashMap.size()] print…