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

Using karate-config parameters in a feature file

The karate header examples do not show how to access config values other than baseUrl. When I switch environments (passing in -Dkarate.env=qual as part of the run command) then baseUrl is set correctly. The problem is, I want to use other config…
roblogic
  • 1,266
  • 2
  • 13
  • 23
11
votes
2 answers

How to test REST endpoint when using callbacks using JAVA?

I want to write some test against an REST endpoint which is using a callback parameter. Might sound confusing so here's an explanation: first call is a POST to /publish with the payload: {"callbackURL":"http://localhost:609/test"} server replies…
vicusbass
  • 1,714
  • 2
  • 19
  • 33
10
votes
1 answer

In Karate how we can collaboratively work along with BA to automate business scenarios

While using Karate we were able to do most of the validations for web services, we were able to successfully integrate Karate with Selenium webdriver and do DB assertions using java classes. For DB we returned the results sets as list by converting…
Sree
  • 331
  • 1
  • 4
  • 14
8
votes
2 answers

Karate karate-config.js not a js function

I'm trying use karate for e2e tests and have started with a minimal setup. I want to create some config items in karate-config.js for use in the tests but karate is reporting that file is not a js function and hence the test fails trying to get the…
Shane Rowatt
  • 1,951
  • 3
  • 27
  • 44
7
votes
2 answers

Is it possible to have multiple JS functions inside one JS file of karate framework?

I need to perform two operations on the result of JSON responses.so can we have those different operations inside single JS file? or do we need to have mapping like one JS file for one operation. Please help on this
vadivelu
  • 142
  • 1
  • 9
7
votes
3 answers

Pass additional parameters to karate-config.js via command line via Maven

I have additional settings that I need to pass to Karate when running via Maven that will be available in karate-config.js. Currently I can pass in a string using the karate.env property - is it necessary to encode my parameters as a JSON object and…
Dunc
  • 83
  • 1
  • 3
6
votes
2 answers

Disable Chrome Password Manager through Karate framework

Trying to pick up the right combination of chrome options to disable annoying Password Manager popup after passing login form. Here is how I create a driver: Feature: Driver initialization Background: * configure retry = { count: 5,…
Dmitry
  • 93
  • 1
  • 4
6
votes
2 answers

Printing to console not working in Karate

I have scenario which tests an Micro service. Scenario Outline: Run Object Queries Scenario Outline: Run Object Queries Given url homeLinks.queryUrl And header Content-Type = 'application/x-www-form-urlencoded' When method post …
Santosh Hegde
  • 3,420
  • 10
  • 35
  • 51
6
votes
3 answers

How to print values in console in karate tests

I'm trying to print value on console but I don't see any value snippet of code And prepresp = response.event.txn_count Then print 'count is : ', response.event.txn_count Then print 'count is : ', prepresp
Shiva Krishna
  • 103
  • 1
  • 2
  • 5
6
votes
1 answer

Karate Gatling with gradle build is not working

I am trying to run gatling with karate in gradle build and getting below error, /smoketests/SmokeTestRunner.java:19: error: package org.junit.runner does not exist import org.junit.runner.RunWith; …
Manoj Mishra
  • 117
  • 6
6
votes
1 answer

Variable in multi-line expression not resolving

I have the following scenario that matches the response against a multi-line expression that contains a variable. This variable is defined in karate-config.js and is present because the test succeeds up to the final step. Background: Given url…
james.lorenzen
  • 466
  • 1
  • 5
  • 13
6
votes
2 answers

How to use if condition in Karate

Suppose I have the following Json response [ { id: 1, name: "John", password: "JohnsPassword54", }, { id: 2, name: "David", password: "DavidsPassword24", } ] Then how can I extract the…
Amir Ghahrai
  • 618
  • 1
  • 7
  • 22
5
votes
2 answers

Is Cypress a good choice for API Automation Testing than Rest Assured/Karate?

I have been googling about using Cypress for Automation API testing. I found below links: Example: Cypress Real World App - API Testing Docs: API Testing Blog: Add GUI to your e2e API tests Plugin: cy-api API Testing with Cypress Most of the cases…
Mahesh Magar
  • 69
  • 1
  • 2
5
votes
1 answer

What's the purpose of karate-junit5 when you can run tests without it?

The Karate docs have 2 examples of testing with Karate and JUnit5: https://github.com/karatelabs/karate#junit-5 https://github.com/karatelabs/karate#junit-5-parallel-execution uses JUnit directly I created a project using only karate-core…
Pete Edwards
  • 97
  • 2
  • 4
5
votes
2 answers

How to Run Karate API tests on Azure pipelines

New to Karate & Azure. Just created few API tests using Karate and easy simple. Want to take it further adding it Azure pipeline. Found few links that just points to add pom.xml and maven from Microsoft. Also found Jekins integration but none for…
Devanathan
  • 63
  • 1
  • 4
1
2 3
99 100