【最全postman系列】动态/随机变量

本文介绍了Postman如何使用faker库生成假数据,包括各种随机变量,如UUID、时间戳等,用于在请求中产生不同的值。这些变量在执行时生成,例如$guid、$timestamp等。同时,文章还列举了各类动态变量的示例,如随机姓名、地址、颜色、电话号码、日期等,适用于测试和预请求或测试脚本。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

动态/随机变量

Postman uses the faker library to generate dummy data. You can generate random names, addresses, email addresses, and much more. You can use these pre-defined variables multiple times to return different values per request.

You can use these variables like any other variable in Postman. Their values are generated at the time of execution and their names start with a $ symbol e.g. $guid, $timestamp etc.

The following is a list of dynamic variables whose values are randomly generated during the request/collection run.

To use dynamic variables in pre-request or test scripts, you need to use pm.variables.replaceIn(), e.g. pm.variables.replaceIn(’{ {$randomFirstName}}’).

Common
Variable Name Description Examples

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值