Karate : Is it feasible to iterate Url to support pagination

我是研究僧i 提交于 2021-02-05 08:58:26

问题


I have a rest endpoint with pagination, I want to verify expected parameter exists by traversing through all pages. One option I could think of is to have an array defined with page offset intervals like {0,25,50....} Welcoming better approaches. Is it feasible to break the loop when my expected condition is met?

ex: Given url 'http://myhost.com/v1/cats/'+'#(offset)'
And request {name : 'Billie'}
When method post
Then status 201

Note: have not tested the above code, looking for better approach.


回答1:


You should be able to figure this out with conditional logic: https://github.com/intuit/karate#conditional-logic

There should be some part of your response that tells you whether there is a "next" page or not. There are ways you can "loop" manually, refer this part of the docs: https://github.com/intuit/karate#polling



来源:https://stackoverflow.com/questions/61925864/karate-is-it-feasible-to-iterate-url-to-support-pagination

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