简体   繁体   English

如何通过REST确保将大量数据输入到查询参数中

[英]how to input large amounts of data into a query parameter via REST Assured

I have an API that returns a list of ~30,000 SKUs. 我有一个API,可返回约30,000个SKU的列表。 I then need to insert each SKU into the query parameter URL of another API to validate the response of this second API. 然后,我需要将每个SKU插入另一个API的查询参数URL中,以验证第二个API的响应。 I know that something like this is possible with Jmeter where you could possibly do this via a CSV file. 我知道Jmeter可以实现类似的功能,您可以通过CSV文件来实现。 How can I accomplish this via REST Assured? 我如何通过REST保证完成此任务? An example/sample would be greatly appreciated! 一个例子/样品将不胜感激!

Similar question also applies to using outputs from an API to use as input in body content... 类似的问题也适用于使用API​​的输出作为正文内容的输入...

Thanks. 谢谢。

Short answer.You can't as it comes to query parameters. 简短的答案。就查询参数而言,您无法做到。 You can have no more than 2000 characters in your URL. URL中的字符数不能超过2000个。 Explanation here : What is the maximum length of a URL in different browsers? 此处的说明: 不同浏览器中URL的最大长度是多少?

With respect of POST method you don't have constraints. 关于POST方法,您没有约束。

If you are open to evaluating alternatives to REST-assured, Karate allows you to easily achieve such a data-driven test and it is based on Cucumber as well. 如果您愿意评估REST保证的替代方案,那么Karate允许您轻松实现这种数据驱动的测试,它也是基于Cucumber的。

Disclaimer: I am the dev. 免责声明:我是开发人员。

In the demos you will find a number of examples that use dynamic JSON data to drive a loop making an HTTP call. 演示中,您将找到许多示例,这些示例使用动态JSON数据来驱动进行HTTP调用的循环。 Yes, you can dynamically use the data in HTTP responses also in future steps. 是的,您也可以在以后的步骤中动态使用HTTP响应中的数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM