karate

How to skip SSL certificate verification with karate?

≯℡__Kan透↙ 提交于 2020-01-30 08:50:06
问题 I'm trying to turn off SSL certificate verification through karate. For now I'm getting error: 13:27:14.668 [main] ERROR com.intuit.karate - javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target, http call failed after 133 milliseconds for URL: https://VRNV02AS04294.int.carlsonwagonlit.com:8443/admin/property/filters

Karate: Query Param values are getting encoded

南楼画角 提交于 2020-01-25 11:24:30
问题 I am using karate 0.6.1 version and facing issue with get request with queryparam. Scenario Outline: Verify the response Data with account details when there are filter values are provided with wildcard Given params { <paramName>: <paramValue> } When method get Then status 200 Examples: | paramName | paramValue | | Name | 'Volvo%' | | Name | 'test data'| in the request url with queryparam becomes like url?Name=Volvo%25 And url?Name=test+data which is not correct, how should i resolve that.

Is it possible to get XML nodes always as array even if there is only one?

我们两清 提交于 2020-01-25 04:35:26
问题 I'm testing a SOAP webservice using Karate. One of the methods is that depending on the request, the response can return one or more coincidences. When transforming that XML response to JSON, if there is only one result, it's is interpreted as an object, but if there are more, then it's an array. Is there any way to make that for a given path, it is always returned as an array? Example XML with only one match: <matches> <product>...</product> </matches Resulting JSON structure: { matches: {

Karate: Write to a text file

旧街凉风 提交于 2020-01-25 03:51:07
问题 I have the following feature file that reads the input and appends the input id with the response and writes to a text file in the below format: |123|{"products": [ { "pid": "1a"} ] }| |124|{"products": [ { "pid": "1b"} ] }| |125|{"products": [ { "pid": "1c"} ] }| so that I can make the input table with it and dont need copy each response in text format and paste to make Examples: I have tried the below: Feature: sample karate test script Background: * url BaseUrl * configure headers = read(

Karate: XML element changed to have empty namespace

风流意气都作罢 提交于 2020-01-25 02:55:11
问题 when a xml message define like below, karate adds empty namespace to child element. Karate feature Feature: test xml Scenario: test xml empty namespace * def x = """ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header/> <soapenv:Body> <validateEmailAddressRequest xmlns="anotherUri"> <request> <email>some@domain.com</email> </request> </validateEmailAddressRequest> </soapenv:Body> </soapenv:Envelope> """ * print x Output 16:39:17.009 [main] INFO com

Karate: XML element changed to have empty namespace

∥☆過路亽.° 提交于 2020-01-25 02:55:08
问题 when a xml message define like below, karate adds empty namespace to child element. Karate feature Feature: test xml Scenario: test xml empty namespace * def x = """ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header/> <soapenv:Body> <validateEmailAddressRequest xmlns="anotherUri"> <request> <email>some@domain.com</email> </request> </validateEmailAddressRequest> </soapenv:Body> </soapenv:Envelope> """ * print x Output 16:39:17.009 [main] INFO com

Karate: Get all users and delete with the reference id

一曲冷凌霜 提交于 2020-01-24 20:54:05
问题 After my tests are completed, I would like to delete all the users that were created. I am able to delete one user at a time. Can we do this using conditional logic? Feature file: Given path 'users' And header Authorization = authId And header Accept = 'application/json;version=2' When method Get Then status 200 Then print 'Response Time: '+ responseTime + ' milliseconds' * def resp = $ * def size = karate.sizeOf(resp) * print 'Number of users: ' + size This gives me below response: [ {

Karate - How to deal with unicode characters?

孤街醉人 提交于 2020-01-24 20:01:05
问题 I want to send a Unicode string as a request parameter like this: {"mobile": "۹۸.۹۱۲۳۴۳۰۴۱۲"} but Karate send it like this instead: {"mobile": "??.??????????"} I've tried to read Unicode text from a file contains my text: ۹۸.۹۱۲۳۴۳۰۴۱۲ then read and send it this way: * def persianMobile1 = read('classpath:account/unicode/persian.mobile.txt') Given url karate.get('urlBase') + "account/activateMobileByVerificationCode" And request """ { "mobile":#(persianMobile1), "code":#

How to retry a request until i get a valid dynamically generated value in response using karate dsl

走远了吗. 提交于 2020-01-24 19:25:12
问题 I am sending a request to fetch the API ID from backend but because my backend is slow it doesn't give back the ID in one go and that's making my test case fail in the first try. Though it passes if I try again, but that's not ideally it should work. I tried putting a sleep, but that doesn't look promising either. My test case is : Given URL storeURL And param query = When method get Then status 200 call read('Sleep.feature') def APIIDStr = response.list[0].id print 'APIID from Store is: ',

Karate UI: driver.location method induces Error: path: $, actual: null

Deadly 提交于 2020-01-24 15:10:28
问题 I am trying to use method driver.location, but as a result I got the error : path: $, actual: null My code: Feature: browser automation Background: * configure driver = { type: 'chromedriver', showDriverLog: true } Scenario: try to login to github and then do a google search Given driver 'https://github.com/login' Then match driver.location == 'https://github.com/login' EROR: path: $, actual: null, How to deal with this behavior? 回答1: First make sure you are on the latest RC version 0.9.5.RC4