get call passes randomly in karate and passes cons

2019-07-30 10:43发布

enter image description hereI 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 enter image description here

标签: karate
1条回答
爷的心禁止访问
2楼-- · 2019-07-30 11:17

Please check whether you have passed all the necessary headers.

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

查看更多
登录 后发表回答