环境
通常用用于访问指定环境的服务,比如测试环境、分级环境、线上环境
变量
变量的使用:
变量赋值:
可在pre request script和 response script中对变量赋值1234pm.globals"variable_key", "variable_value"); (pm.collectionVariables"variable_key", "variable_value"); (pm.environment"variable_key", "variable_value"); (pm.variables"variable_key", "variable_value"); (
动态变量123456789{{$timestamp}} 时间戳{{$randomInt}} 0-1000随机数{{$randomIP}}{{$randomFirstName}}在脚本中使用动态变量pm.variables.replaceIn('{{$randomFirstName}}')参考: https://learning.postman.com/docs/postman/variables-and-environments/variables-list/
添加query值
pm.request.url.query.add(‘hello=world’)
Debug
为方便调试,Postman提供了debug控制台,访问路径view->show postman console