Postman内置的动态变量

Postman使用faker library来生成动态数据。您可以生成随机姓名,地址,电子邮件地址等。您可以多次使用这些预定义的变量来为每个请求返回不同的值。

您可以像在Postman中使用任何其他变量一样使用这些变量。它们的值在执行时生成,并且它们的名称以$符号开头,例如$guid$timestamp等等。

以下是动态变量的列表,其动态值在请求/收集运行期间随机生成。

要在预请求或测试脚本中使用动态变量,您需要使用pm.variables.replaceIn(),例如pm.variables.replaceIn('{{$randomFirstName}}')

常用

变量名称描述例子
$guid一个uuid-v4风格GUID"611c2e81-2ccb-42d8-9ddc-2d0bfa65c1b4"
"3a721b7f-7dc9-4c45-9777-516942b98e0d"
"22eca807-006b-47df-9511-e92e37f5071a"
$timestamp当前UNIX时间戳(以秒为单位)156275710715627571081562757109
$isoTimestamp当前ISO时间戳(UTC为零)2020-06-09T21:10:36.177Z
2019-10-21T06:05:50.000Z
2019-07-29T18:29:00.000Z
$randomUUID随机的36个字符的UUID"6929bb52-3ab2-448a-9796-d6480ecad36b"
"53151b27-034f-45a0-9f0a-d7b6075b67d0"
"727131a2-2717-44ad-ab02-006587e947dc"

文字,数字和颜色

变量名称描述例子
$randomAlphaNumeric随机字母数字字符6"y""z"
$randomBoolean随机布尔值(真/假)truefalsefalsetrue
$randomInt1至1000之间的随机整数802494200
$randomColor随机颜色"red""fuchsia""grey"
$randomHexColor随机十六进制值"#47594a""#431e48""#106f21"
$randomAbbreviation随机缩写SQLPCIJSON

互联网和IP地址

变量名称描述例子
$randomIP随机的IPv4地址241.102.234.100216.7.27.38
$randomIPV6随机的IPv6地址dbe2:7ae6:119b:c161:1560:6dda:3a9b:90a9
c482:23a4:ce4c:a668:7736:6cc5:b0b6:cc37
c791:18d1:fbba:87d8:d929:22aa:5a0a:ac3d
$randomMACAddress随机MAC地址33:d4:68:5f:b4:c71f:6e:db:3d:ed:fa
$randomPassword随机的15个字符的字母数字密码t9iXe7COoDKv8k3QAzNFQtvR9cg2rq
$randomLocale随机的两个字母的语言代码(ISO 639-1)"ny""sr""si"
$randomUserAgent随机用户代理Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.9.8; rv:15.6) Gecko/20100101 Firefox/15.6.6
Opera/10.27 (Windows NT 5.3; U; AB Presto/2.9.177 Version/10.00)
Mozilla/5.0 (Windows NT 6.2; rv:13.5) Gecko/20100101 Firefox/13.5.6
$randomProtocol随机互联网协议"http""https"
$randomSemver随机语义版本号7.0.52.5.86.4.9

姓名

变量名称描述例子
$randomFirstName随机名字EthanChandlerMegane
$randomLastName随机姓氏SchadenSchneiderWillms
$randomFullName随机的名字和姓氏Connie RunolfsdottirSylvan FayJonathon Kunze
$randomNamePrefix随机名称前缀Dr.Ms.Mr.
$randomNameSuffix随机名称后缀IMDDDS

职业

变量名称描述例子
$randomJobArea随机工作区MobilityIntranetConfiguration
$randomJobDescriptor随机作业描述符ForwardCorporateSenior
$randomJobTitle随机职位International Creative Liaison
Product Factors Officer
Future Interactions Executive
$randomJobType随机工作类型SupervisorManagerCoordinator

电话,地址和位置

变量名称描述例子
$randomPhoneNumber随机的10位数电话号码700-008-5275494-261-3424662-302-7817
$randomPhoneNumberExt带扩展名的随机电话号码(12位数字)27-199-983-386499-841-448-2775
$randomCity随机城市名称SpinkahavenKorbinburghLefflerport
$randomStreetName随机的街道名称Kuhic IslandGeneral StreetKendrick Springs
$randomStreetAddress随机街道地址5742 Harvey Streets47906 Wilmer Orchard
$randomCountry随机国家Lao People's Democratic RepublicKazakhstanAustria
$randomCountryCode随机的2个字母的国家/地区代码(ISO 3166-1 alpha-2)CVMDTD
$randomLatitude随机纬度坐标55.209927.3644-84.7514
$randomLongitude随机经度坐标40.6609171.7139-159.9757

图片

变量名称描述例子
$randomImage随机图像http://lorempixel.com/640/480/technics
http://lorempixel.com/640/480/food
http://lorempixel.com/640/480/business
$randomAvatarImage随机头像https://s3.amazonaws.com/uifaces/faces/twitter/johnsmithagency/128.jpg
https://s3.amazonaws.com/uifaces/faces/twitter/xadhix/128.jpg
https://s3.amazonaws.com/uifaces/faces/twitter/martip07/128.jpg
$randomImageUrl随机图片的网址http://lorempixel.com/640/480
$randomAbstractImage随机抽象图片的网址http://lorempixel.com/640/480/abstract
$randomAnimalsImage随机动物图片的网址http://lorempixel.com/640/480/animals
$randomBusinessImage随机库存企业图片的网址http://lorempixel.com/640/480/business
$randomCatsImage随机猫图像的URLhttp://lorempixel.com/640/480/cats
$randomCityImage随机城市图片的网址http://lorempixel.com/640/480/city
$randomFoodImage随机食物图片的网址http://lorempixel.com/640/480/food
$randomNightlifeImage随机夜生活图片的网址http://lorempixel.com/640/480/nightlife
$randomFashionImage随机时尚图片的网址http://lorempixel.com/640/480/fashion
$randomPeopleImage一个人的随机图像的URLhttp://lorempixel.com/640/480/people
$randomNatureImage随机自然图像的URLhttp://lorempixel.com/640/480/nature
$randomSportsImage随机运动图像的URLhttp://lorempixel.com/640/480/sports
$randomTechnicsImage随机技术图片的网址http://lorempixel.com/640/480/technics
$randomTransportImage随机交通图片的网址http://lorempixel.com/640/480/transport
$randomImageDataUri随机图像数据URI

金融

变量名称描述例子
$randomBankAccount随机的8位数字银行帐号094540736565344075728757
$randomBankAccountName随机的银行帐户名称(例如,储蓄帐户,支票帐户)Home Loan AccountChecking AccountAuto Loan Account
$randomCreditCardMask随机屏蔽的信用卡号362258156257
$randomBankAccountBic随机BIC(银行识别码)EZIAUGJ1KXCUTVJ1DIVIPLL1
$randomBankAccountIban15-31个字符的随机IBAN(国际银行帐号)MU20ZPUN3039684000618086155TKZ
BR7580569810060080800805730W2
XK241602002200395017
$randomTransactionType随机交易类型(例如发票,付款,存款)invoicepaymentdeposit
$randomCurrencyCode随机的3个字母的货币代码(ISO-4217)CDFZMKGNF
$randomCurrencyName随机货币名称CFP FrancCordoba OroPound Sterling
$randomCurrencySymbol随机货币符号$£
$randomBitcoin随机比特币地址3VB8JGT7Y4Z63U68KGGKDXMLLH5
1GY5TL5NEX3D1EA0TCWPLGVPQF5EAF
14IIEXV2AKZAHSCY2KNYP213VRLD

商业

变量名称描述例子
$randomCompanyName随机公司名称Johns - KassulkeGrady LLC
$randomCompanySuffix随机的公司后缀(例如,Inc,LLC,Group)IncLLCGroup
$randomBs商务说话的随机短语killer leverage schemas
bricks-and-clicks deploy markets
world-class unleash platforms
$randomBsAdjective随机的商务口语形容词viral24/724/365
$randomBsBuzz随机企业说流行语repurposeharnesstransition
$randomBsNoun随机说话e-servicesmarketsinterfaces

标语(警句)

变量名称描述例子
$randomCatchPhrase随机的流行语Future-proofed heuristic open architecture
Quality-focused executive toolset
Grass-roots real-time definition
$randomCatchPhraseAdjective随机的流行语形容词Self-enablingBusiness-focusedDown-sized
$randomCatchPhraseDescriptor随机标语描述符bandwidth-monitoredneeds-basedhomogeneous
$randomCatchPhraseNoun随机生成一个流行短语secured linesuperstructureinstallation

数据库

变量名称描述例子
$randomDatabaseColumn随机数据库列名称updatedAttokengroup
$randomDatabaseType随机数据库类型tinyinttext
$randomDatabaseCollation随机数据库排序规则cp1250_binutf8_general_cicp1250_general_ci
$randomDatabaseEngine随机数据库引擎MyISAMInnoDBMemory

日期

变量名称描述例子
$randomDateFuture未来的随机日期时间Tue Mar 17 2020 13:11:50 GMT+0530 (India Standard Time)
Fri Sep 20 2019 23:51:18 GMT+0530 (India Standard Time)
Thu Nov 07 2019 19:20:06 GMT+0530 (India Standard Time)
$randomDatePast随机过去的日期时间Sat Mar 02 2019 09:09:26 GMT+0530 (India Standard Time)
Sat Feb 02 2019 00:12:17 GMT+0530 (India Standard Time)
Thu Jun 13 2019 03:08:43 GMT+0530 (India Standard Time)
$randomDateRecent最近的随机日期时间Tue Jul 09 2019 23:12:37 GMT+0530 (India Standard Time)
Wed Jul 10 2019 15:27:11 GMT+0530 (India Standard Time)
Wed Jul 10 2019 01:28:31 GMT+0530 (India Standard Time)
$randomWeekday随机工作日ThursdayFridayMonday
$randomMonth随机月份FebruaryMayJanuary

域,电子邮件和用户名

变量名称描述例子
$randomDomainName随机域名gracie.bizarmando.biztrevor.info
$randomDomainSuffix随机域后缀orgnetcom
$randomDomainWord随机的不合格域名gwenjadendonnell
$randomEmail随机电子邮件地址Pablo62@gmail.comRuthe42@hotmail.comIva.Kovacek61@hotmail.com
$randomExampleEmail来自“示例”域的随机电子邮件地址Talon28@example.comQuinten_Kerluke45@example.netCasey81@example.net
$randomUserName随机用户名Jarrell.GutkowskiLottie.Smitham24Alia99
$randomUrl随机网址https://anais.nethttps://tristin.nethttp://jakob.name

文件和目录

变量名称描述例子
$randomFileName随机文件名(包括不常见的扩展名)neural_sri_lanka_rupee_gloves.gdoc
plastic_awesome_garden.tif
incredible_ivory_agent.lzh
$randomFileType随机文件类型(包括不常见的文件类型)modelapplicationvideo
$randomFileExt随机文件扩展名(包括不常见的扩展名)warbookfsc
$randomCommonFileName随机文件名well_modulated.mpg4
rustic_plastic_tuna.gif
checking_account_end_to_end_robust.wav
$randomCommonFileType随机的常见文件类型applicationaudio
$randomCommonFileExt随机的通用文件扩展名m2vwavpng
$randomFilePath随机文件路径/home/programming_chicken.cpio
/usr/obj/fresh_bandwidth_monitored_beauty.onetoc
/dev/css_rustic.pm
$randomDirectoryPath随机目录路径/usr/bin/root/usr/local/bin
$randomMimeType随机MIME类型audio/vnd.vmx.cvsd
application/vnd.groove-identity-message
application/vnd.oasis.opendocument.graphics-template

商店

变量名称描述例子
$randomPrice100.00至999.00之间的随机价格531.55488.76511.56
$randomProduct随机产品TowelsPizzaPants
$randomProductAdjective随机产品形容词UnbrandedIncredibleTasty
$randomProductMaterial随机产品材料SteelPlasticFrozen
$randomProductName随机产品名称Handmade Concrete TunaRefined Rubber Hat
$randomDepartment随机贸易类别ToolsMoviesElectronics

英语语法

变量名称描述例子
$randomNoun随机名词matrixbusbandwidth
$randomVerb随机动词parsequantifynavigate
$randomIngverb以“ -ing”结尾的随机动词synthesizingnavigatingbacking up
$randomAdjective随机形容词auxiliarymulti-byteback-end
$randomWord随机词withdrawalinfrastructuresIB
$randomWords一些随机的单词Samoa Synergistic sticky copying Grocery
Corporate Springs
Christmas Island Ghana Quality
$randomPhrase随机短语You can't program the monitor without navigating the mobile XML program!
overriding the capacitor won't do anything, we need to compress the optical SMS transmitter!
I'll generate the virtual AI program, that should microchip the RAM monitor!

文本内容(乱数假文)

变量名称描述例子
$randomLoremWord文本的随机单词est
$randomLoremWords文本的一些随机词vel repellat nobis
$randomLoremSentence文本的随机句子Molestias consequuntur nisi non quod.
$randomLoremSentences文本的2-6个随机句子Et sint voluptas similique iure amet perspiciatis vero sequi atque. Ut porro sit et hic. Neque aspernatur vitae fugiat ut dolore et veritatis. Ab iusto ex delectus animi. Voluptates nisi iusto. Impedit quod quae voluptate qui.
$randomLoremParagraph文本的随机段落Ab aliquid odio iste quo voluptas voluptatem dignissimos velit. Recusandae facilis qui commodi ea magnam enim nostrum quia quis. Nihil est suscipit assumenda ut voluptatem sed. Esse ab voluptas odit qui molestiae. Rem est nesciunt est quis ipsam expedita consequuntur.
$randomLoremParagraphs文本的3个随机段落Voluptatem rem magnam aliquam ab id aut quaerat. Placeat provident possimus voluptatibus dicta velit non aut quasi. Mollitia et aliquam expedita sunt dolores nam consequuntur. Nam dolorum delectus ipsam repudiandae et ipsam ut voluptatum totam. Nobis labore labore recusandae ipsam quo.
Voluptatem occaecati omnis debitis eum libero. Veniam et cum unde. Nisi facere repudiandae error aperiam expedita optio quae consequatur qui. Vel ut sit aliquid omnis. Est placeat ducimus. Libero voluptatem eius occaecati ad sint voluptatibus laborum provident iure.
Autem est sequi ut tenetur omnis enim. Fuga nisi dolor expedita. Ea dolore ut et a nostrum quae ut reprehenderit iste. Numquam optio magnam omnis architecto non. Est cumque laboriosam quibusdam eos voluptatibus velit omnis. Voluptatem officiis nulla omnis ratione excepturi.
$randomLoremText随机数量的文本Quisquam asperiores exercitationem ut ipsum. Aut eius nesciunt. Et reiciendis aut alias eaque. Nihil amet laboriosam pariatur eligendi. Sunt ullam ut sint natus ducimus. Voluptas harum aspernatur soluta rem nam.
$randomLoremSlug随机 URL段eos-aperiam-accusamusbeatae-id-molestiaequi-est-repellat
$randomLoremLines1-5随机行Ducimus in ut mollitia.\nA itaque non.\nHarum temporibus nihil voluptas.\nIste in sed et nesciunt in quaerat sed.

官方原文:

https://learning.postman.com/docs/writing-scripts/script-references/variables-list/

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值