karate

Karate Java Function problems

﹥>﹥吖頭↗ 提交于 2019-12-24 01:03:37
问题 so here I'm trying to invoke a java class that goes and retrieves information from a database the problem is that it sometimes works and sometimes it doesn't and well I'm quite not seeing it and would love it if you could share your insights, I have a DAO class that has a method that receives a number and uses a SQL statement through JDBC to connect, then I map the information as I need it in a Map<String, String> then returns that map, I'm trying to compare values of that map to those of the

Logging Messages from Java Class back to the Karate Report

寵の児 提交于 2019-12-24 00:48:53
问题 We have a scenario where we have to post a json request and then validate few actions in the UI. So we have a karate feature file which hits a request and after that we are invoking a java class from within the feature file. The java class would run the Selenium Webdriver test of us. In the java methods we have few Assertions/Info Messages which we would like to log back to the Karate Reports. Is there a way in Karate with which we can write these messages from my Java Class to the Karate

How to make sure no extra fields are returned in the response

做~自己de王妃 提交于 2019-12-24 00:45:11
问题 My actual api response is { "data": { "0000164": { "2019-02-11": { "MAPLE": 5, "OAK": 15 } } }, "request_data": null, "status": 200 } This is my expected api response { "data": { "0000164": { "2019-02-11": { "MAPLE": 5, "OAK": 15 } } }, "status": 200 } If you notice I don't want my api response to have "request_data" field or any other field extra other than the expected How do I make sure that my api is not returning any junk key value pairs Currently this is how I am validating And match $

Karate 0.9.1 is not generating cucumber.json which is used for cucumber reports

牧云@^-^@ 提交于 2019-12-23 04:19:25
问题 When using Karate 0.6.1 with cucumber. It is generating test result outputs to cucumber.json file in the path specified in the code. It is then used for generating the cucumber reports using Masterthought. @RunWith(Karate.class) @CucumberOptions(monochrome = true, features = "SampleFeature.feature", plugin = {"pretty", "html:target/site/cucumber-pretty", "json:target/cucumber-html-reports/cucumber.json" }) But when we migrated to Karate 0.9.1 to read inputs from csv file. Now, it is failing

Karate - Match two dynamic responses

久未见 提交于 2019-12-23 03:09:38
问题 I have to compare my WebService response with its downstream service. But, the IDs in my response and downstream response are not identical. I am giving sample responses below. And again, one is a REST service and another SOAP service, however i can do typeconversion (Thats not an issue) MyWebService Response: "myWebServiceResponse": { "webServiceSummary": { "service": { "serviceCd": "ABCD", "serviceDescription": "Checking Main Service", "hypotheticalInd": "100.0", "realInd": "200.0" },

Karate Api Testing - How to pass data from one feature file to another

可紊 提交于 2019-12-22 14:10:08
问题 I need to pass data from one feature file to another. Feature(1): Create a new user Background: * url 'http://127.0.0.1:8900/' * header Accept = 'application/json' Scenario: Create a new user Given path '/user' And request {"email" : "test@test.com", "name" : "Brian"} When method post And def newUser = $..id Then status 201 Feature(2): Call newUser from feature 1 Background: * url 'http://127.0.0.1:8900/' * header Accept = 'application/json' Scenario: Call User * def newUser = $..id * print

Karate Api Testing - How to pass data from one feature file to another

≡放荡痞女 提交于 2019-12-22 14:07:14
问题 I need to pass data from one feature file to another. Feature(1): Create a new user Background: * url 'http://127.0.0.1:8900/' * header Accept = 'application/json' Scenario: Create a new user Given path '/user' And request {"email" : "test@test.com", "name" : "Brian"} When method post And def newUser = $..id Then status 201 Feature(2): Call newUser from feature 1 Background: * url 'http://127.0.0.1:8900/' * header Accept = 'application/json' Scenario: Call User * def newUser = $..id * print

I want to pass multiple arguments in karate-config.js through mvn command

时间秒杀一切 提交于 2019-12-21 21:06:10
问题 I want to want pass multiple arguments in mvn command and and that should be read in karate-config.js file. e.g: mvn test -DargLine="-Dkarate.env='gdcStaging', -Dkarate.source='false', -Dkarate.natco='gdc'" I didn't want to declare any .prop files, want to get these values at run time. Below prop. are defined to read these arguments but unable to achieve from this: var environment = karate.env; var natco = karate.properties['karate.natco']; var isLocal = java.lang.System.getenv('karate.source

Cannot escape url as needed

微笑、不失礼 提交于 2019-12-20 04:14:04
问题 I am tring to escape some values in a path. Let's say I'm trying to obtain https://www.google.com/https%3A%2F%2Fdomain I've tried the following options : Scenario: escape value * url "https://www.google.com" * path "https://domain" When method get * path "https\:\/\/domain" When method get * path "https%3A%2F%2Fdomain" When method get * path "https\\:\\/\\/domain" When method get But I obtain https://www.google.com/https://domain https://www.google.com/https://domain https://www.google.com

want to test assertion of integer value should be >3 in Karate API

我与影子孤独终老i 提交于 2019-12-20 03:52:15
问题 json response is "Value": 0.23 i want to put assertion here value should be less than 3 so how to do this ? tried some examples in documentation but they are for array format of jsonenter code here Scenario: Shows the minimum time any DB request to CS will take This value is an important indicator for the performance of the database access. Given path 'admin/rest/status/db/' When method get Then status 200 And match response contains { Value: ">3"} * match Value == { '#? _ > 3' } * match $