如何从Postman Collection Runner Results中将响应主体导出/下载到外部文件中? [英] How to export/download Response Body into an external file from Postman Collection Runner Results?

查看:952
本文介绍了如何从Postman Collection Runner Results中将响应主体导出/下载到外部文件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一个项目中,我必须多次使用不同的变量值来访问Web服务



例如,



我敢肯定,您可以采取一些变通方法来将响应正文保存为环境或全局变量,然后再将其导出,但这似乎很尴尬并且有些黑解决方案。

  pm.globals.set('response_body',JSON.stringify(pm.response.json()))

虽然每次都会被覆盖,所以您每次都需要更改变量名称,或者在您的代码中进行某些更改以更改其名称,以获得唯一的一组。



然后可以将其导出并保存使用管理环境部分在本地进行。


I am working on a project where I have to hit a web service multiple times with different values of a variable

For example, http://mywebservice.com?variable1={{value}}

and different values are passed using Postman collection runner.

I want to download the response body of all the requests into a file. How do I do that?

解决方案

I don't think you can download the response body of the request in the collection runner - You can export the test results but i'm not sure that this contain the response body data. You can also click on each request in the runner and see the response body but this is still all within the UI.

For individual requests you can use the Send and Download option, which will show you the response body:

I'm sure there is some workaround that you could do to save the response body as an environment or global variable and then export this after but it seems like an awkward and slightly hacks solution.

pm.globals.set('response_body', JSON.stringify(pm.response.json()))

This would get overwritten each time though, so you would need to change the variable name each time, or have something in your code to change its name, to get a unique set of them.

These can then be exported and saved locally using the Manage Environment section.

这篇关于如何从Postman Collection Runner Results中将响应主体导出/下载到外部文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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