用 Postman 做接口自动化(十)内置变量

内置变量dynamic variables是由 Postman 提供的大量预设变量,用来生成一些随机值,方便测试过程中通过一些重复性校验。

在构造请求的时候,输入{,就会出现这些预设变量的待选项:

Postman 提供了非常多类型的随机生成的内容,可以在测试的时候省去很多构造数据的过程。

不过有点遗憾的是,里面生成的内容都是因为的。

由于这些变量如此众多,不用看完,需要的时候再来查阅即可。最重要的内容是随机生成唯一性的字符串变量

随机唯一性字符串

这些是唯一性很强的字符串,对于一些有唯一限制的内容可以使用这些值来填充。

Variable NameDescriptionExamples
$guiduuid-v4 风格的 guid,随机性非常强“611c2e81-2ccb-42d8-9ddc-2d0bfa65c1b4”
“3a721b7f-7dc9-4c45-9777-516942b98e0d”
“22eca807-006b-47df-9511-e92e37f5071a”
$timestamp时间戳1562757107 , 1562757108 , 1562757109
$randomUUID随机 36 位的 UUID“6929bb52-3ab2-448a-9796-d6480ecad36b”
“53151b27-034f-45a0-9f0a-d7b6075b67d0”

随机文字、字符串、颜色(码)

Variable NameDecriptionExamples
$randomAlphaNumeric1位随机字符或数字6 , "y" , "z"
$randomBoolean随机布尔值 (true/false)true , false , false , true
$randomInt1~1000 之间的随机整数802 , 494 , 200
$randomColor随机颜色单词"red" , "fuchsia" , "grey"
$randomHexColor随机颜色码"#47594a" , "#431e48" , "#106f21"
$randomAbbreviation随机缩写SQL , PCI , JSON

随机网络标识和 IP 地址

Variable NameDecriptionExamples
$randomIP随机的 IPv4 地址241.102.234.100 , 216.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:c7 , 1f:6e:db:3d:ed:fa
$randomPassword由字母和数字组成的 15 位随机密码t9iXe7COoDKv8k3 , QAzNFQtvR9cg2rq
$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.5 , 2.5.8 , 6.4.9

随机姓名(英文)

Variable NameDecriptionExamples
$randomFirstName随机的名字(英文)Ethan , Chandler , Megane
$randomLastName随机姓氏(英文)Schaden , Schneider , Willms
$randomFullName随机全名(名字 姓氏)Connie Runolfsdottir , Sylvan Fay , Jonathon Kunze
$randomNamePrefix随机称呼Dr. , Ms. , Mr.
$randomNameSuffix随机姓名后缀I , MD , DDS

职业

Variable NameDecriptionExamples
$randomJobArea随机工作范围Mobility , Intranet , Configuration
$randomJobDescriptor随机职业等级Forward , Corporate , Senior
$randomJobTitle随机工作标题International Creative Liaison ,
Product Factors Officer ,
Future Interactions Executive
$randomJobType随机工作类型Supervisor , Manager , Coordinator

随机电话号码、区域、地址

Variable NameDecriptionExamples
$randomPhoneNumber随机 10 位数字电话号码700-008-5275 , 494-261-3424 , 662-302-7817
$randomPhoneNumberExt随机扩展号码(包含区号)27-199-983-3864 , 99-841-448-2775
$randomCity随机城市名称Spinkahaven , Korbinburgh , Lefflerport
$randomStreetName随机街道名称Kuhic Island , General Street , Kendrick Springs
$randomStreetAddress随机街道地址5742 Harvey Streets , 47906 Wilmer Orchard
$randomCountry随机国家名称Lao People's Democratic Republic , Kazakhstan , Austria
$randomCountryCode随机两位字符的国家编码 (ISO 3166-1 alpha-2)CV , MD , TD
$randomLatitude随机纬度55.2099 , 27.3644 , -84.7514
$randomLongitude随机精度40.6609 , 171.7139 , -159.9757

随机图片

Variable NameDecriptionExamples
$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随机猫图片http://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随机人物图片http://lorempixel.com/640/480/people
$randomNatureImage随机自然风景图片http://lorempixel.com/640/480/nature
$randomSportsImage随机运动图片http://lorempixel.com/640/480/sports
$randomTechnicsImage随机科技图片http://lorempixel.com/640/480/technics
$randomTransportImage随机交通工具图片http://lorempixel.com/640/480/transport
$randomImageDataUri随机图片的 data 数据data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%20baseProfile%3D%22full%22%20width%3D%22undefined%22%20height%3D%22undefined%22%3E%20%3Crect%20width%3D%22100%25%22%20height%3D%22100%25%22%20fill%3D%22grey%22%2F%3E%20%20%3Ctext%20x%3D%220%22%20y%3D%2220%22%20font-size%3D%2220%22%20text-anchor%3D%22start%22%20fill%3D%22white%22%3Eundefinedxundefined%3C%2Ftext%3E%20%3C%2Fsvg%3E

随机金融类数据

Variable NameDecriptionExamples
$randomBankAccount随机的8位数字银行帐号09454073 , 65653440 , 75728757
$randomBankAccountName随机的银行帐户名称(e.g. savings account, checking account)Home Loan Account , Checking Account , Auto Loan Account
$randomCreditCardMask随机屏蔽的信用卡号3622 , 5815 , 6257
$randomBankAccountBic随机银行识别码 (Bank Identifier Code)EZIAUGJ1 , KXCUTVJ1 , DIVIPLL1
$randomBankAccountIban随机 15-31位的国际银行帐号 (International Bank Account Number)MU20ZPUN3039684000618086155TKZ
BR7580569810060080800805730W2
XK241602002200395017
$randomTransactionType随机交易类型 (e.g. invoice, payment, deposit)invoice , payment , deposit
$randomCurrencyCode随机的 3 位字母的货币代码 (ISO-4217)CDF , ZMK , GNF
$randomCurrencyName随机货币名称CFP Franc , Cordoba Oro , Pound Sterling
$randomCurrencySymbol随机货币标志$ , £
$randomBitcoin随机比特币地址3VB8JGT7Y4Z63U68KGGKDXMLLH5
1GY5TL5NEX3D1EA0TCWPLGVPQF5EAF
14IIEXV2AKZAHSCY2KNYP213VRLD

随机商业数据

Variable NameDecriptionExamples
$randomCompanyName随机公司名称Johns - Kassulke , Grady LLC
$randomCompanySuffix随机公司后缀(e.g. Inc, LLC, Group)Inc , LLC , Group
$randomBs随机商业用语killer leverage schemas ,
bricks-and-clicks deploy markets ,
world-class unleash platforms
$randomBsAdjective随机商业形容词用语viral , 24/7 , 24/365
$randomBsBuzz随机商业流行词repurpose , harness , transition
$randomBsNoun随机商业名词e-services , markets , interfaces

随机警句(标语)

Variable NameDecriptionExamples
$randomCatchPhrase随机名言警句Future-proofed heuristic open architecture ,
Quality-focused executive toolset ,
Grass-roots real-time definition
$randomCatchPhraseAdjective随机流行语形容词Self-enabling , Business-focused , Down-sized
$randomCatchPhraseDescriptor随机流行描述符号bandwidth-monitored , needs-based , homogeneous
$randomCatchPhraseNoun随机生成给一个流行名词secured line , superstructure , installation

随机数据库相关数据

Variable NameDecriptionExamples
$randomDatabaseColumn随机数据库列名updatedAt , token , group
$randomDatabaseType随机数据库类型tinyint , text
$randomDatabaseCollation随机数据库排序规则cp1250_bin , utf8_general_ci , cp1250_general_ci
$randomDatabaseEngine随机数据库引擎MyISAM , InnoDB , Memory

随机日期

Variable NameDecriptionExamples
$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随机星期几Thursday , Friday , Monday
$randomMonth随机月份February , May , January

随机域名、电子邮件和用户名

Variable NameDecriptionExamples
$randomDomainName随机完整域名gracie.biz , armando.biz , trevor.info
$randomDomainSuffix随机顶级域名org , net , com
$randomDomainWord随机不合法域名gwen , jaden , donnell
$randomEmail随机电子邮箱地址Pablo62@gmail.com , Ruthe42@hotmail.com , Iva.Kovacek61@hotmail.com
$randomExampleEmail随机电子邮箱地址,域名为exampleTalon28@example.com , Quinten_Kerluke45@example.net , Casey81@example.net
$randomUserName随机用户名Jarrell.Gutkowski , Lottie.Smitham24 , Alia99
$randomUrl随机 URL 地址https://anais.net , https://tristin.net , http://jakob.name

随机文件名和目录

Variable NameDecriptionExamples
$randomFileName随机文件名 (包括不常用的扩展名)neural_sri_lanka_rupee_gloves.gdoc ,
plastic_awesome_garden.tif ,
incredible_ivory_agent.lzh
$randomFileType随机文件类型 (包括不常用的文件类型)model , application , video
$randomFileExt随机文件扩展名 (包括不常见的文件扩展名)war , book , fsc
$randomCommonFileName随机文件名well_modulated.mpg4 ,
rustic_plastic_tuna.gif ,
checking_account_end_to_end_robust.wav
$randomCommonFileType随机常见文件类型application , audio
$randomCommonFileExt随机常见文件扩展名m2v , wav , png
$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 类型(header 中的 content-type 会用到)audio/vnd.vmx.cvsd ,
application/vnd.groove-identity-message ,
application/vnd.oasis.opendocument.graphics-template

随机物料(库存、商品等)

Variable NameDecriptionExamples
$randomPrice随机生成 100.00 ~ 999.00 之间的价格531.55 , 488.76 , 511.56
$randomProduct随机商品Towels , Pizza , Pants
$randomProductAdjective随机商品形容词Unbranded , Incredible , Tasty
$randomProductMaterial随机商品材料Steel , Plastic , Frozen
$randomProductName随机商品名称Handmade Concrete Tuna , Refined Rubber Hat
$randomDepartment随机商业分类Tools , Movies , Electronics

基于英语语法的随机数据

Variable NameDecriptionExamples
$randomNoun随机名词matrix , bus , bandwidth
$randomVerb随机动词parse , quantify , navigate
$randomIngverb随机带 “-ing” 的动词synthesizing , navigating , backing up
$randomAdjective随机形容词auxiliary , multi-byte , back-end
$randomWord随机单词withdrawal , infrastructures , IB
$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!

随机的文本内容

Variable NameDecriptionExamples
$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-accusamus , beatae-id-molestiae , qui-est-repellat
$randomLoremLines由随机单词构成的 1~5 行数据(用回车符分隔)Ducimus in ut mollitia.\nA itaque non.\nHarum temporibus nihil voluptas.\nIste in sed et
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值