karate

Karate - Parsing XML with namespace

橙三吉。 提交于 2020-01-05 08:54:10
问题 I need to parse and print ns4:feature part. Karate prints it in json format. I tried referring to this answer. But, i get 'ERROR: 'Namespace for prefix 'xsi' has not been declared.' error, if used suggested xPath. i.e., * def list = $Test1/Envelope/Body/getPlan/planSummary/feature[1] This is my XML: It contains lot many parts with different 'ns' values, but i have given here an extraxt. <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Header/> <S:Body> <ns9:getPlan xmlns

Error “actual value is not a string” while performing assertion in Karate

血红的双手。 提交于 2020-01-05 07:55:27
问题 actual value is not a string error Getting an error while performing an assertion field1 = [1850, 700, 30] field2 = ["1850.0","30.0","700.0"] Error- assertion failed: path: $, actual: [1850, 700, 30], expected: '["1850.0","30.0","700.0"]', reason: actual value is not a string 回答1: Yes, because it is not a string. This will work: * def field1 = [1850, 700, 30] * def field2 = ["1850.0","30.0","700.0"] * def field3 = karate.map(field2, function(x){ return ~~x }) * match field1 contains only

How to run the feature file for definite number for times in karate framework?

人走茶凉 提交于 2020-01-05 07:51:14
问题 Example: I need to post the payment for an account for 100 times with same set data . In that case how to iterate the particular feature file using karate framework. Please help on this issue. 回答1: Sounds like you need a performance testing tool instead of Karate. But still, if you insist, here is the best reference example call-dynamic-json.feature. Also make sure you read the section on data-driven features in the documentation. All the best ! 来源: https://stackoverflow.com/questions

How to run the feature file for definite number for times in karate framework?

与世无争的帅哥 提交于 2020-01-05 07:51:03
问题 Example: I need to post the payment for an account for 100 times with same set data . In that case how to iterate the particular feature file using karate framework. Please help on this issue. 回答1: Sounds like you need a performance testing tool instead of Karate. But still, if you insist, here is the best reference example call-dynamic-json.feature. Also make sure you read the section on data-driven features in the documentation. All the best ! 来源: https://stackoverflow.com/questions

How to use eval in karate?

家住魔仙堡 提交于 2020-01-05 06:50:45
问题 I already gone through the karate documentation and tried below code: * eval if (nearby.content[?(@.title == 'Nearby Malls & Restaurants')] == '#notnull') karate.call(* def nearByMallsRestraurants = get nearby.content[?(@.title == 'Nearby Malls & Restaurants')].items[?(@.name)]) But its throwing error.I am trying to extract all Nearby Malls & Restaurants names if Nearby Places and Landmarks Array contains Nearby Malls & Restaurant.Also if possible can you please tell me how to use collection

how to configure the name and classname attributes on the JUnit XML report

倖福魔咒の 提交于 2020-01-05 06:15:44
问题 In order to integrate with an external test management solution and have visibility of karate results, I need to import them using the JUnit XML report. Test cases identified in JUnit's XML report are identified by the name and classname attributes on the element. However, it seems that these names are being generated somehow dynamicaly and not as unique identifiers that clearly identify the original testcase. The ideal case would be to have unique identifiers for the corresponding testcases,

Migration form karate 0.9.2 to 0.9.3 Issue - javascript evaluation failed

强颜欢笑 提交于 2020-01-05 04:29:06
问题 karate-config.js has config = karate.callSingle('classpath:token-read.js', config); Javascript function on token-read.js is function fn(config) { var userAccessToken = Java.type("com.OAuth2Token"); config['OAuth2'] = { adminUser: function () { return userAccessToken.getAuthorizationHeader(name, url, users, "ADMIN"); }, }; return config; } Feature file code is as below Feature: Search data Scenario: Sample Given url url Given path '/data' And header Authorization = OAuth2.adminUser() // Using

I am getting getting SSL handshake issue How to disable ssl in karate

旧街凉风 提交于 2020-01-05 03:46:41
问题 When I am trying to access a secure endpoint, I am getting SSL handshake exception even after I disable ssl by using the following karate ways. option1) declared the following in feature file * configure ssl = true option2) declared the following in karate-config.js karate.configure('ssl', { trustAll: true }); (or) karate.configure('ssl', true); Exception: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath

How to use -a in command line?

浪尽此生 提交于 2020-01-04 14:04:20
问题 As documented for standalone-jar I'm trying to provide args to my feature and can't figure how to get it work. what do I miss ? My command line : java -jar c:\karate\karate-0.9.1.jar -a myKey1=myValue1 TestArgs.feature karate-config.js function fn() { var env = karate.env; karate.log('karate.env system property was:', env); if (!env) { env = 'test'; } var config = { // base config JSON arg:karate.properties['myKey1'] }; return config; } TestArgs.feature Feature: test args Scenario: print args

I'm not able to understand the dynamic data tables scenarios in Karate

狂风中的少年 提交于 2020-01-04 07:34:52
问题 Anybody know how to use the csv file to create a dynamic data tables. I'm trying to use the Code defined in the documentation but it's not working for me. 回答1: The read function accepts csv files and creates an array of json objects from the csv. Header row is always expected and the header is used to create the name of the object members. Suppose you have a csv like this: [data.csv]: name,likes Cucuma,1 Canyon,2 Stevens,3 Then the following test is green Scenario: Read CSV file and convert