问题
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