karate

Karate: Is there a http-request hook in karate, that gets called automatically after every API call, and whose behaviour I can modify?

一曲冷凌霜 提交于 2020-05-05 14:27:08
问题 I want a common implementation to write the: request-body, request-method & response-body to an output file for all the HTTP requests that I make in any of the karate feature files. I have read through the documentation, and the closest option that I found was the afterScenario hook. However this doesn't help me in cases where I want to make multiple API calls in the same scenario. I also tried using karate.prevRequest object by passing it to java function that I wrote. While this helps me

Karate UI drag and drop

|▌冷眼眸甩不掉的悲伤 提交于 2020-04-28 10:23:48
问题 I am studying KarateUI possibilities. And I tried to use drag and drop functionality of framework. I used a page with draggable elements https://www.seleniumeasy.com/test/drag-and-drop-demo.html and my script does not work on it. What is wrong with my script? Here it is: mouse().move('{div/span}Draggable 1').down().move('#mydropzone').up() And i also see in console of IDE next log 16:11:40.196 [ForkJoinPool-1-worker-1] DEBUG c.intuit.karate.driver.DriverOptions - >> {"method":"Input

Karate UI drag and drop

别来无恙 提交于 2020-04-28 10:23:13
问题 I am studying KarateUI possibilities. And I tried to use drag and drop functionality of framework. I used a page with draggable elements https://www.seleniumeasy.com/test/drag-and-drop-demo.html and my script does not work on it. What is wrong with my script? Here it is: mouse().move('{div/span}Draggable 1').down().move('#mydropzone').up() And i also see in console of IDE next log 16:11:40.196 [ForkJoinPool-1-worker-1] DEBUG c.intuit.karate.driver.DriverOptions - >> {"method":"Input

Karate - how to access an array element by UUID during a 'retry until' statement

丶灬走出姿态 提交于 2020-04-18 06:54:12
问题 I have an endpoint which returns this JSON response: { "jobs": [ { "name": "job1", "id": "d6bd9aa1-0708-436a-81fd-cf22d5042689", "status": "pending" }, { "name": "job2", "id": "4fdaf09f-51de-4246-88fd-08d4daef6c3e", "status": "pending" } ] I would like to repeatedly GET call this endpoint until the job I care about ( "job2" ) has a "status" of "completed" , but I'd like to check this by using a UUID stored in a variable from a previous call. i.e. by doing something like this: #NB: code for

Complex data-driven test reading multiple files

你。 提交于 2020-04-17 22:22:06
问题 I have one example where i was not able to achieve my problem with Karate. I have 25 ecg files where I should upload them to a patient. There's an index file which contains the right order of those files. But before uploading via API, I need read that index file, find the next file to upload. Also i need to rename those file with a specific naming convention cause every file i upload via api should.be unique. The name consist of patient email, a timestamp and an index. Also timestamp in the

How can I get Karate logs printed in the report?

烈酒焚心 提交于 2020-04-16 03:58:05
问题 I have <logger name="com.intuit.karate" level="DEBUG"/> in my logback-test.xml. But when I run my tests I see that when the step * assert SchemaUtils.isValid(response, schema) fails, I do not see any debug information in the Cucumber report (with the payload and description on which field is missing or which value is wrong), like: error: object instance has properties which are not allowed by the schema: ["PrSKU"] level: "error" I do see it in the console though: {content_type=, value=21:54

Can we limit the number of request hits per second in karate

六眼飞鱼酱① 提交于 2020-04-16 03:22:46
问题 I am using karate 0.9.0. I need to limit the request hits to 5 per second in my test suite due to threshold limit at gateway. is it possible in karate or not? If yes, how? 回答1: Here is the suggestion - configure headers as a JavaScript function. Within the function body - use a Java singleton (and a static method) to track how many requests have been sent and how much "sleep" needs to be added to maintain the required throttling / threshold. You will need some Java skills to do this, all the

Can we limit the number of request hits per second in karate

放肆的年华 提交于 2020-04-16 03:22:13
问题 I am using karate 0.9.0. I need to limit the request hits to 5 per second in my test suite due to threshold limit at gateway. is it possible in karate or not? If yes, how? 回答1: Here is the suggestion - configure headers as a JavaScript function. Within the function body - use a Java singleton (and a static method) to track how many requests have been sent and how much "sleep" needs to be added to maintain the required throttling / threshold. You will need some Java skills to do this, all the

Declare Global variables in background of feature-karate Soap API

时间秒杀一切 提交于 2020-03-23 17:19:30
问题 I am using karate for SOAP API services. How can I declare a global variable ?? as you can see in below feature file? after print response I have variable name def ourSession = /Envelope/Body/LoginReturn I am using this variable ( ourSession ) in next scenario but it's failing ? but it's not global. So how can I declare "ourSession" as a global variable ?? so I can use into other scenarios? Any help will be highly appreciated. Please have a look of my feature file below; # Feature: SOAP calls

Trying to do some assertion from request, which will be present in response

喜欢而已 提交于 2020-03-23 14:14:31
问题 I am passing the request as in my feature file and i am trying to do assert from request to response. I have tried must contains queries but i am not sure if i am doing it correct, could you please help. **Background:** * configure headers = read('classpath:merchantServiceheaders.js') Given url MservUrl And path '/spapis/rest/sp-ms-engine/sp/ms/v1/engine/scanandredact' Scenario Outline: ACH Low Value Payment Rips Services Summary ] }*** What i would like to do is assert what i have in my