karate

Nested JSON response Validation

别来无恙 提交于 2019-12-12 19:46:02
问题 JSON Response { Feed[ {"item_type":"cycle","id":123}, {"item_type":"computer","name":"mac"}, {"item_type":"Bag","weight":"2"} ] } As nested schema is changing based on item type so can we compare schema based on item type? example: if item_type is cycle then it should compare with id, if item_type is computer then it should compare name like this I have tried with below: * def schema = {item_type:"#string",id:'##number',name: '##string',weight:'##string'} in this schema validation even item

If examples has too many columns ,every row will be too long to read!

假如想象 提交于 2019-12-12 18:47:01
问题 If examples has too many columns ,every row will be too long to read! Feature: Background: Scenario Outline: * match '<msg>' == <prefix> + ',' + '<end>' Examples: | prefix | end | msg | | hello | mike | hello,mike | | hello | jerry | hello,jerry | Could it be like that: Feature: Background: Examples: | prefix | | hello | Scenario Outline: * match '<msg>' == <prefix> + ',' + '<end>' Examples: | end | msg | | mike | hello,mike | | jerry | hello,jerry | I want to divide the examples in several

Karate — Parallel execution Failing

僤鯓⒐⒋嵵緔 提交于 2019-12-12 18:19:36
问题 I have observed that when I am running my tests (feature files) in maven build with Runner.parallel(getClass(), 1); it is working fine but when I am increasing number of thread like Runner.parallel(getClass(), 5); it start failing because it is executing all scenarios in parallel which is available in feature file. Scenarios are dependent on each other which are failing because which scenario need to execute in last executing in first. Please suggest me some option which run all feature file

How do i selectively ignore certain .feature files in my build while using karate framework?

冷暖自知 提交于 2019-12-12 18:18:12
问题 I have to ignore certain .feature test files for my integration test suite using karate framework. Is there any way in which i can selectively exclude certain files. 回答1: Yes, the answer is tags. Example: @ignore Feature: my feature Scenario: # blah And on the command-line: mvn test -Dcucumber.options="--tags ~@ignore" -Dtest=MyIntegrationSuiteRunner 来源: https://stackoverflow.com/questions/48009320/how-do-i-selectively-ignore-certain-feature-files-in-my-build-while-using-karat

Visual reporting for Karate without Jenkins CI

自作多情 提交于 2019-12-12 16:27:53
问题 I'm trying to get reporting working for Karate DSL, and it's proven a challenge because my team uses Circle CI instead of Jenkins. Cucumber reporting seems to only work for Jenkins. I've had a look at this documentation, here: https://github.com/intuit/karate/tree/master/karate-demo#example-report https://github.com/jenkinsci/cucumber-reports-plugin I was wondering if there is a circle friendly equivalent you could recommend? It'd be even better if the reports could be generated in the

Having a POJO like feature in KarateAPI?

狂风中的少年 提交于 2019-12-12 15:02:27
问题 I have been using Karate and RestAssured for sometime. There are advantages and downside of both tools of course. Right now I have a RestAssured project where I have Request and Response object and POJOs. My requests wraps my endpoint and send my POJOs to those endpoint. I do all my Headers, etc configuration in an abstract layer. In case I need to override them, I override them during the test. If not, Its a two lines of code for me to trigger an endpoint. My way of working with happy path

Java.net.SocketTimeoutException when running a feature file in Karate

大兔子大兔子 提交于 2019-12-11 17:15:15
问题 When running my feature file i get this error. java.lang.RuntimeException: java.net.SocketTimeoutException: Read timed out I have tried to add a readTimeout by i get the same exception all the time. * configure readTimeout = 10000 Do you guys have any ideas ? Thanks in advance. 回答1: I have solved the problem by switching karate-jersey with karate-apache in the pom.xml . 来源: https://stackoverflow.com/questions/57708876/java-net-sockettimeoutexception-when-running-a-feature-file-in-karate

For loop is not working as expected in Function in Karate

僤鯓⒐⒋嵵緔 提交于 2019-12-11 15:03:26
问题 I am using below code to get the JSON response from the array but I am able to get only till a position of 12. the script is passing but I am expecting more than 218 values to get printed. Feature: Verify Branches Background: For loop implementation Given url '' When method GET Then status 200 * def i = 000 * def z = response.locations[i].zip * def p = response.locations[i].phone * def fun = """ function(locations){ for (var i = 0; i < response.locations.length; i++) { print(i) print('Element

Karate API Testing - Sorting Validation Scenario

假装没事ソ 提交于 2019-12-11 13:23:57
问题 I have a request which produces below response: { "totalRows": 10, "colDefs": [ { "entityAttributeId": "somestring", "headerName": "somestring", "field": "someNumber", "entityPath": "", "entityId": "somestring" }, { "entityAttributeId": "somestring", "headerName": "somestring", "field": "someNumber", "entityPath": "somestring", "entityId": "somestring" }, { "entityAttributeId": "somestring", "headerName": "somestring", "field": "1", "entityPath": "", "entityId": "somestring" }, {

Configuring proxy in karate-config.js get parse error

落爺英雄遲暮 提交于 2019-12-11 12:43:15
问题 I have proxy settings for our testing, e.g., function() { var config = { // base config JSON sslConfig: true, apiUrl: 'https://my-api.com', api2Url: 'https://my-api2.com', proxy: { uri: 'http://my-proxy.com:3128', nonProxyHosts: [ 'my-api2.com', ] } }; karate.configure('connectTimeout', 10001); karate.configure('readTimeout', 10000); karate.configure('proxy', config.proxy); return config; } And it works fine in 0.9.2, after upgrade to 0.9.3, I get parsing error message below and process