空手道:迭代Url以支持分页是否可行 [英] Karate : Is it feasible to iterate Url to support pagination

查看:44
本文介绍了空手道:迭代Url以支持分页是否可行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有分页的rest端点,我想通过遍历所有页面来验证期望的参数是否存在.我想到的一个选择是定义一个数组,该数组的页面偏移间隔为{0,25,50 ....} 欢迎更好的方法.满足我的预期条件时打破循环是否可行?

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.

推荐答案

您应该能够使用条件逻辑来解决这个问题: https://github.com/intuit/karate#conditional-logic

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

您的回复中应该有一部分告诉您是否存在下一页"页面.有一些方法可以手动循环",请参考文档的此部分: https://github.com /intuit/karate#polling

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

这篇关于空手道:迭代Url以支持分页是否可行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆