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

KarateUI - Finding inputs by placeholder attribute

I've been having trouble around finding elements by attribute/property. Following UI visible example: The unique piece is the…
Puti
  • 101
  • 8
3
votes
1 answer

Running features in parallel by tags in Karate

I have a end to end test suite with features marked with @e2e tag. The features are within different modules namely WNG, DTC, FFD with their own tags(like @e2eWNG, @e2eDTC, @e2eFFD) along with @e2e. Each of the modules can run independently and I…
Mihir
  • 491
  • 5
  • 21
3
votes
1 answer

Having trouble getting content-encoding to show up in response header for get request

I was trying to write a karate test that validated that a particular response header contained the Content-Encoding header field with a value of gzip. I tried on my api where both times the content-encoding field was missing from karate's response.…
JChu
  • 33
  • 4
3
votes
1 answer

How to pass multiple json records using data driven approach in Karate DSL?

We have gone through the Karate documentation where we can compare the exact JSON object as a response (which contains multiple data records) but how can we pass and read the JSON in a single scenario? Below is my sample.JSON and I want to read this…
Madhur
  • 51
  • 3
3
votes
1 answer

Karate Tests: How to match contains each nested array response with just one schema

Is possible to match each element of a nested array response (using contains) using just one schema? I have a set of yml files with request params and response schemas, like this one: response: appId: '#string' attributes: '#array' login:…
ivangsa
  • 117
  • 10
3
votes
1 answer

After updating from 0.9.2 to 0.9.5 getting the error "java.lang.IllegalArgumentException: Illegal group reference"

My test suite was working fine until it was using the version 0.9.2. I have a test runner with KarateOptions in it to specify the feature files that are to be executed @KarateOptions(tags = {"~@ignore"}, features = { …
3
votes
1 answer

Can we fail Scenario/Scenario-Outline from afterScenario in Karate

Can we fail a scenario/scenario-outline from afterScenario in karate, As there are no soft assertions in karate. I want my karate code to run complete scenario and finally it should report what are failure and pass. Work Around:- 1. I tried karate…
3
votes
1 answer

Sharing connections in karate gatling load tests

https://gatling.io/docs/current/http/http_protocol/#http-protocol-connection-sharing How do you share connections using karateProtocol?
unclelim12
  • 603
  • 1
  • 8
  • 22
3
votes
1 answer

It´s possible to do Database driven tests using data tables using Karate?

When writing my API tests with Cucumber I have implemented some step definitions that allow specifying the data that needs to exist in the database for each scenario. Something like this: Given I have database table "users" with data: | id | name …
brpaz
  • 3,618
  • 9
  • 48
  • 75
3
votes
1 answer

How to loop over array values in a karate feature

I am trying to loop over array values in a karate feature file. In a Feature1.feature - Scenario1, I have some values in the array ["UUID1","UUID2","UUID3"] and I want to call another feature file (Feature2.feature) (having a code to call a DELETE…
SahilDua
  • 95
  • 8
3
votes
1 answer

How to Handle SSL Certificate in karateUI driver?

When I open my resource, I am faced with notification "Your connection is not private". Is there a way to disable the verification of the server certificate in the browser or specify the desired trusted certificate through configuring the karate…
Svitlana
  • 83
  • 2
3
votes
1 answer

Karate DSL : Unable to convert string characters from different languages while reading json file

I was trying to match whole response with a json file. Background: * url BaseURL * def resp = read('response_get_discount.json') // Reading json file Scenario: Verify Users discount Given path '/discount' When method get …
3
votes
1 answer

How to setup Proxy in Karate config file

I am using the following syntax in karate feature file and it works but I want to add this globally in karate config file so that I don't have to add in all of my feature file individually * configure proxy = { uri: 'http://xx.xx.xxx.xx:8080',…
3
votes
4 answers

If then else implementation to chose baseURL in Karate DSL

I have a little tricky requirement in Karate. I have a set of baseURL's in my karate.config which are chosen based on the implementation. Here is the snippet of it: if (env == 'qa') { config.apiKey = apiKey; config.tsp_api =…
Mihir
  • 491
  • 5
  • 21
3
votes
1 answer

Is there a way to run Karate tests as an integration test suite against a pre-booted spring boot server?

Is there any good way to get Karate tests to test a Spring-Boot microservice in the "integration-test" phase of a Maven build? What I mean is: is there an anti-pattern/workaround that works well OR am I out of luck because this was an afterthought…
djangofan
  • 28,471
  • 61
  • 196
  • 289