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
1
vote
0 answers

Not able to pass CSV file data to call another feature in background

Not able to call one feature file from another when passing the data via CSV. Same works when i directly give in examples. The below works Background: def rspSes = call read('classpath:helpers/createSessionID.feature') {"customerNo":…
Navneeth
  • 21
  • 1
1
vote
0 answers

Unable to access config file from mock file after upgrading to 1+ version of Karate

I'm using the driver.intercept feature of Karate to intercept a browser request and fetch values. In the mock feature similar to the one in here, I'm accessing the karate.config variables following a suggestion in Karate Server feature file cannot…
Vijay
  • 13
  • 4
1
vote
0 answers

Is there any way to run to run Karate feature files programatically from java code

I have a requirement to run karate feature files when someone invokes specifically to run them. So I want to run it programmatically from java code. I have tried running karate feature files as JUnit files programmatically but they do not generate…
1
vote
1 answer

Karate - Capture entire scrollable page (vertically) with scrollable element (horizontally)

I have below .feature file which is use to capture the webpage * def bytes = screenshot(false) * def writeToPath = karate.write(bytes, path) This code can work normally, it can capture and save the picture to the path. But the picture captured is a…
Aommie
  • 21
  • 1
1
vote
0 answers

Karate - Referencing variable within schema, js function

I have .js file whose content is as below... where companyAssociations is list of object for which i have defined schema on top in var... function() { var companyAssociationsSchema = '{"companyId":"#string", "displayName":"#string",…
Pman
  • 11
  • 2
1
vote
1 answer

Is there any possibility of running the UI script in headless mode when we use the robot functions and * robot.click('google.png')

I am trying to run the script in headless mode(* configure driver = { type: 'chrome', headless: true } ) but it's failing due to usage of robot functions like robot.click('google.png') robot.input('oliver' + Key.ENTER) etc. Kindly suggest the…
oliver
  • 75
  • 6
1
vote
1 answer

I want to create swagger file with karate framework.Is there any way to Create swagger file with karate?

I want to create swagger file with karate framework.Is there any way to Create swagger file with karate? Or Share swagger file creation process. Could anyone please provide a solution. Thanks
1
vote
0 answers

Can we have a report in karate containing the history of all the reports?

For example: i ran some test cases today and generated a report and tomorrow i ran some more test cases and generated a report, is it possible to have a report having the history of all the reports i have generated before with the date mentioned on…
1
vote
0 answers

How can we customize Karate Report

Is There Any Way to Customize Karate Report. When I say Customized Karate Report, Which means I can write Log and add screenshot in report as we can do in cucumber report with help of scenario.log and Web driver.
1
vote
1 answer

Karate ReferenceError: package is not defined

I'm using java codes in karate feature file, refering github demo: Background: * url demoBaseUrl * def JavaDemo = Java.type('com.intuit.karate.demo.util.JavaDemo') I noticed that the feature file is in src/test/java, which defined as classpath in…
1
vote
0 answers

Karate netty/mock schema match not working

I am using karate 1.1.0 version. I need to create a mock service where an object is optional. When I create a service like this Feature: Karate netty - testing for optional. The request payload may have either benefiaciary.cardInfo object or…
Dinesh Arora
  • 2,115
  • 3
  • 24
  • 30
1
vote
0 answers

Not able to switch to parent page if child page is self closing in Karate

I am stucked with following flow in Karate feature testcase Open parent page Click on hyperlink which opens another page Switch to new page Click on hyperlink which causes it to self close Try to switch back to prior page Somehow I am getting…
1
vote
0 answers

karate match valuea == valueb MINUS a value from the Examples section sometimes doesn't work

I start off by extracting the 'amount' from the json response. (This is the originalBalance) After performing another action I then extract the 'amount' from another json response. (This is the newBalance). I am then doing a match to check that the…
Matt
  • 773
  • 2
  • 15
  • 30
1
vote
0 answers

How to setup header for HTTP requests outside of Karate Feature File and not write anything about it in the feature file?

While working on a application upon using Karate framework, I need to setup header for authorization before calling any HTTP request on a url. And I don't want to write about header in every Scenario in the feature file. What I want is before…
1
vote
1 answer

Getting error in Karate v1.1.0 - TypeError: invokeMember (contains) on ["ABC","XYZ","OTHR","NEW"] failed due to: Message not supported

I was using Karate v0.9.6 all this while. Recently thought of upgrading the version to 1.1.0 and then 1.2.0. One thing is troubling a lot is as belows, Earlier I used to use 'contains' to verify in the schema that #An array of expected values def…
1 2 3
99
100