get call passes randomly in karate and passes consistently in postman

隐身守侯 提交于 2019-12-13 02:25:44

问题


I am trying to call get call. These calls are not passing consistently. Where I am getting proper CXRF token.

GET URL call:

Given url appServer +'/integration/live/rest/accessProfile'+'?page=0'+'&pageSize=10'+'&sortBy=name'+'&fieldList=name,id,date_created,date_modified,created_id,modified_id'+'&filter=id%20not%20equal%20to%20%27200%27%20AND%20id%20not%20equal%20to%20%27100%27%20AND%20id%20not%20equal%20to%20%27101%27%20AND%20id%20not%20equal%20to%20%27102%27%20AND%20id%20not%20equal%20to%20%27103%27%20'+'&getTotalRecordCount=true

complete code:

Scenario: create Access Profile
Given url appServer +'/integration/live/rest/accessProfile'+'?page=0'+'&pageSize=10'+'&sortBy=name'+'&fieldList=name,id,date_created,date_modified,created_id,modified_id'+'&filter=id%20not%20equal%20to%20%27200%27%20AND%20id%20not%20equal%20to%20%27100%27%20AND%20id%20not%20equal%20to%20%27101%27%20AND%20id%20not%20equal%20to%20%27102%27%20AND%20id%20not%20equal%20to%20%27103%27%20'+'&getTotalRecordCount=true'
And header X-CSRF-TOKEN = csrfToken
* cookie JSESSIONID = jsessionid

Given request ' '
When method get
Then status 200
And print response
Then match response.platform.message.code contains '0'
Then match response.platform.message.description contains 'Success'


* def accessProfileNames = get response.platform.record[*].name
* print accessProfileNames
Then  match accessProfileNames contains 'TestAccessProfile'


#fetch the access profile id
* def AccessProfileNode = get[0] response.platform.record[?(@.name=='TestAccessProfile')]
* def accessProfileId = AccessProfileNode.id
* print accessProfileId

Attached the screenshot for reference


回答1:


Please check whether you have passed all the necessary headers.

Most likely you missed one - for example a cookie that is needed.



来源:https://stackoverflow.com/questions/52054509/get-call-passes-randomly-in-karate-and-passes-consistently-in-postman

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!