karate

Karate DSL: Getting connection timeout error

左心房为你撑大大i 提交于 2021-02-13 05:44:12
问题 I am working on automating a API which is hosted in China server and when I send a request it throws me timeout exception ( org.apache.http.conn.HttpHostConnectException ). My feature file: Background: * url 'http://myurl' * configure connectTimeout = 500000 Scenario: Get Client details Given path '/clients' And header Authorization = 'sdssSSLwWDSD' When method get Then match response.client_id == 'TestId' Error details: 11:22:30.347 [main] DEBUG org.apache.http.impl.conn

KARATE, VScode : “Run Karate Test” codelens not displayed

泄露秘密 提交于 2021-02-11 17:44:53
问题 Visual Studio Code 1.43.0 Karate Standalone JAR 0.9.5.RC5 In the VScode editor, in a Karate .feature file opened, the codelens "Run Karate Test", as shown in the screenshot, isn't displayed anymore. So, it is impossible to debug a specific scenario. Any idea about this? Thanks a lot. In a correct configuration, it looks like this : 回答1: We are still unable to reproduce this issue. Referencing some searches it appears this may be due to a broader issue such as other plugins Eg. Intellisense.

How to use two or more csv file in a single feature file in karate?

本小妞迷上赌 提交于 2021-02-11 07:23:58
问题 I am thinking of using two csv files in a single feature file, but unable to do so, sharing a demo code for the same: Scenario Outline: * driver 'https://github.com/login' * input('#login_field', '<username>') * input('#password', '<password>') * submit().click("input[name=commit]") * match html('#js-flash-container') contains 'Incorrect username or password.' Examples: |read('one.csv')| |read('two.csv')| Here, <username> is stored in one.csv and <password> is stored in two.csv, is there a

Karate: Match a dynamic child response with the Parent API response

拥有回忆 提交于 2021-02-11 04:54:14
问题 I have a scenario where a portion of the Parent API response is from a child API. If the child API response(which is dynamic) has only one array element then no need to match that in parent API response, if array size > 1 then I need to match from index 1 on wards with parent API response. * def child = {"array1":[{"mbr1":{"id":"A1"}},{"mbr2":{"id":"A2"}}]} There is no specific order for the child api response and array1 can have "n" number of array elements (mbr1,mbr2,mbr3, etc) If the child

Karate: Match a dynamic child response with the Parent API response

故事扮演 提交于 2021-02-11 04:52:46
问题 I have a scenario where a portion of the Parent API response is from a child API. If the child API response(which is dynamic) has only one array element then no need to match that in parent API response, if array size > 1 then I need to match from index 1 on wards with parent API response. * def child = {"array1":[{"mbr1":{"id":"A1"}},{"mbr2":{"id":"A2"}}]} There is no specific order for the child api response and array1 can have "n" number of array elements (mbr1,mbr2,mbr3, etc) If the child

Match html response in karate

久未见 提交于 2021-02-11 02:10:01
问题 I hava a problem in matching my response errors with html. I tried like this match $.errors == '#present' match $.errors == response Errors: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Error</title> </head> <body> <pre>Error: Unexpected object!</pre> </body> </html> I'm doing it like this and the scnario will be stoped! When method post * if (responseStatus == 500 ) karate.abort() Then status 200 * match $.errors == '#notpresent' How can I do to get the response

Match html response in karate

做~自己de王妃 提交于 2021-02-11 02:01:38
问题 I hava a problem in matching my response errors with html. I tried like this match $.errors == '#present' match $.errors == response Errors: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Error</title> </head> <body> <pre>Error: Unexpected object!</pre> </body> </html> I'm doing it like this and the scnario will be stoped! When method post * if (responseStatus == 500 ) karate.abort() Then status 200 * match $.errors == '#notpresent' How can I do to get the response

Match html response in karate

偶尔善良 提交于 2021-02-11 02:00:30
问题 I hava a problem in matching my response errors with html. I tried like this match $.errors == '#present' match $.errors == response Errors: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Error</title> </head> <body> <pre>Error: Unexpected object!</pre> </body> </html> I'm doing it like this and the scnario will be stoped! When method post * if (responseStatus == 500 ) karate.abort() Then status 200 * match $.errors == '#notpresent' How can I do to get the response

Match html response in karate

佐手、 提交于 2021-02-11 01:56:35
问题 I hava a problem in matching my response errors with html. I tried like this match $.errors == '#present' match $.errors == response Errors: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Error</title> </head> <body> <pre>Error: Unexpected object!</pre> </body> </html> I'm doing it like this and the scnario will be stoped! When method post * if (responseStatus == 500 ) karate.abort() Then status 200 * match $.errors == '#notpresent' How can I do to get the response

Karate: Signing AWS HTTP requests & add the generated headers to the 'request headers'

家住魔仙堡 提交于 2021-02-11 00:23:07
问题 The internal API's we test need to go through the process of signing them (i.e., get AWS Signature) & add the signed headers to 'request headers' before we do any CRUD operation. Signing the requests can happen through AWS-SDK or using something like this https://github.com/lucasweb78/aws-v4-signer-java (if our tests are written completely in Java) What would be the optimum way of achieving this in Karate DSL. Please suggest. 回答1: Read the docs: https://github.com/intuit/karate#http-basic