Postman內(nèi)置的動態(tài)變量

Postman使用faker library來生成動態(tài)數(shù)據(jù)。您可以生成隨機(jī)姓名,地址,電子郵件地址等。您可以多次使用這些預(yù)定義的變量來為每個請求返回不同的值。

您可以像在Postman中使用任何其他變量一樣使用這些變量。它們的值在執(zhí)行時生成,并且它們的名稱以$符號開頭,例如$guid$timestamp等等。

以下是動態(tài)變量的列表,其動態(tài)值在請求/收集運(yùn)行期間隨機(jī)生成。

要在預(yù)請求或測試腳本中使用動態(tài)變量,您需要使用pm.variables.replaceIn(),例如pm.variables.replaceIn('{{$randomFirstName}}')

常用

變量名稱 描述 例子
$guid 一個uuid-v4風(fēng)格GUID "611c2e81-2ccb-42d8-9ddc-2d0bfa65c1b4"
"3a721b7f-7dc9-4c45-9777-516942b98e0d"
"22eca807-006b-47df-9511-e92e37f5071a"
$timestamp 當(dāng)前UNIX時間戳(以秒為單位) 1562757107,1562757108,1562757109
$isoTimestamp 當(dāng)前ISO時間戳(UTC為零) 2020-06-09T21:10:36.177Z
2019-10-21T06:05:50.000Z
2019-07-29T18:29:00.000Z
$randomUUID 隨機(jī)的36個字符的UUID "6929bb52-3ab2-448a-9796-d6480ecad36b"
"53151b27-034f-45a0-9f0a-d7b6075b67d0"
"727131a2-2717-44ad-ab02-006587e947dc"

文字,數(shù)字和顏色

變量名稱 描述 例子
$randomAlphaNumeric 隨機(jī)字母數(shù)字字符 6,"y","z"
$randomBoolean 隨機(jī)布爾值(真/假) truefalse,false,true
$randomInt 1至1000之間的隨機(jī)整數(shù) 802494,200
$randomColor 隨機(jī)顏色 "red","fuchsia","grey"
$randomHexColor 隨機(jī)十六進(jìn)制值 "#47594a""#431e48","#106f21"
$randomAbbreviation 隨機(jī)縮寫 SQL,PCI,JSON

互聯(lián)網(wǎng)和IP地址

變量名稱 描述 例子
$randomIP 隨機(jī)的IPv4地址 241.102.234.100, 216.7.27.38
$randomIPV6 隨機(jī)的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 隨機(jī)MAC地址 33:d4:68:5f:b4:c7, 1f:6e:db:3d:ed:fa
$randomPassword 隨機(jī)的15個字符的字母數(shù)字密碼 t9iXe7COoDKv8k3QAzNFQtvR9cg2rq
$randomLocale 隨機(jī)的兩個字母的語言代碼(ISO 639-1) "ny","sr""si"
$randomUserAgent 隨機(jī)用戶代理 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 隨機(jī)互聯(lián)網(wǎng)協(xié)議 "http", "https"
$randomSemver 隨機(jī)語義版本號 7.0.5,2.5.8,6.4.9

姓名

變量名稱 描述 例子
$randomFirstName 隨機(jī)名字 Ethan,Chandler,Megane
$randomLastName 隨機(jī)姓氏 SchadenSchneider,Willms
$randomFullName 隨機(jī)的名字和姓氏 Connie Runolfsdottir,Sylvan FayJonathon Kunze
$randomNamePrefix 隨機(jī)名稱前綴 Dr.,Ms.,Mr.
$randomNameSuffix 隨機(jī)名稱后綴 I,MDDDS

職業(yè)

變量名稱 描述 例子
$randomJobArea 隨機(jī)工作區(qū) Mobility,Intranet,Configuration
$randomJobDescriptor 隨機(jī)作業(yè)描述符 Forward,Corporate,Senior
$randomJobTitle 隨機(jī)職位 International Creative Liaison,
Product Factors Officer
Future Interactions Executive
$randomJobType 隨機(jī)工作類型 Supervisor,Manager,Coordinator

電話,地址和位置

變量名稱 描述 例子
$randomPhoneNumber 隨機(jī)的10位數(shù)電話號碼 700-008-5275494-261-3424,662-302-7817
$randomPhoneNumberExt 帶擴(kuò)展名的隨機(jī)電話號碼(12位數(shù)字) 27-199-983-386499-841-448-2775
$randomCity 隨機(jī)城市名稱 Spinkahaven,Korbinburgh,Lefflerport
$randomStreetName 隨機(jī)的街道名稱 Kuhic Island,General Street,Kendrick Springs
$randomStreetAddress 隨機(jī)街道地址 5742 Harvey Streets, 47906 Wilmer Orchard
$randomCountry 隨機(jī)國家 Lao People's Democratic RepublicKazakhstan,Austria
$randomCountryCode 隨機(jī)的2個字母的國家/地區(qū)代碼(ISO 3166-1 alpha-2) CV,MD,TD
$randomLatitude 隨機(jī)緯度坐標(biāo) 55.2099,27.3644-84.7514
$randomLongitude 隨機(jī)經(jīng)度坐標(biāo) 40.6609,171.7139,-159.9757

圖片

變量名稱 描述 例子
$randomImage 隨機(jī)圖像 http://lorempixel.com/640/480/technics
http://lorempixel.com/640/480/food
http://lorempixel.com/640/480/business
$randomAvatarImage 隨機(jī)頭像 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 隨機(jī)圖片的網(wǎng)址 http://lorempixel.com/640/480
$randomAbstractImage 隨機(jī)抽象圖片的網(wǎng)址 http://lorempixel.com/640/480/abstract
$randomAnimalsImage 隨機(jī)動物圖片的網(wǎng)址 http://lorempixel.com/640/480/animals
$randomBusinessImage 隨機(jī)庫存企業(yè)圖片的網(wǎng)址 http://lorempixel.com/640/480/business
$randomCatsImage 隨機(jī)貓圖像的URL http://lorempixel.com/640/480/cats
$randomCityImage 隨機(jī)城市圖片的網(wǎng)址 http://lorempixel.com/640/480/city
$randomFoodImage 隨機(jī)食物圖片的網(wǎng)址 http://lorempixel.com/640/480/food
$randomNightlifeImage 隨機(jī)夜生活圖片的網(wǎng)址 http://lorempixel.com/640/480/nightlife
$randomFashionImage 隨機(jī)時尚圖片的網(wǎng)址 http://lorempixel.com/640/480/fashion
$randomPeopleImage 一個人的隨機(jī)圖像的URL http://lorempixel.com/640/480/people
$randomNatureImage 隨機(jī)自然圖像的URL http://lorempixel.com/640/480/nature
$randomSportsImage 隨機(jī)運(yùn)動圖像的URL http://lorempixel.com/640/480/sports
$randomTechnicsImage 隨機(jī)技術(shù)圖片的網(wǎng)址 http://lorempixel.com/640/480/technics
$randomTransportImage 隨機(jī)交通圖片的網(wǎng)址 http://lorempixel.com/640/480/transport
$randomImageDataUri 隨機(jī)圖像數(shù)據(jù)URI

金融

變量名稱 描述 例子
$randomBankAccount 隨機(jī)的8位數(shù)字銀行帳號 09454073,65653440,75728757
$randomBankAccountName 隨機(jī)的銀行帳戶名稱(例如,儲蓄帳戶,支票帳戶) Home Loan Account,Checking AccountAuto Loan Account
$randomCreditCardMask 隨機(jī)屏蔽的信用卡號 3622,58156257
$randomBankAccountBic 隨機(jī)BIC(銀行識別碼) EZIAUGJ1,KXCUTVJ1,DIVIPLL1
$randomBankAccountIban 15-31個字符的隨機(jī)IBAN(國際銀行帳號) MU20ZPUN3039684000618086155TKZ
BR7580569810060080800805730W2
XK241602002200395017
$randomTransactionType 隨機(jī)交易類型(例如發(fā)票,付款,存款) invoice,payment,deposit
$randomCurrencyCode 隨機(jī)的3個字母的貨幣代碼(ISO-4217) CDFZMK,GNF
$randomCurrencyName 隨機(jī)貨幣名稱 CFP Franc,Cordoba OroPound Sterling
$randomCurrencySymbol 隨機(jī)貨幣符號 $,
$randomBitcoin 隨機(jī)比特幣地址 3VB8JGT7Y4Z63U68KGGKDXMLLH5
1GY5TL5NEX3D1EA0TCWPLGVPQF5EAF
14IIEXV2AKZAHSCY2KNYP213VRLD

商業(yè)

變量名稱 描述 例子
$randomCompanyName 隨機(jī)公司名稱 Johns - KassulkeGrady LLC
$randomCompanySuffix 隨機(jī)的公司后綴(例如,Inc,LLC,Group) Inc,LLC,Group
$randomBs 商務(wù)說話的隨機(jī)短語 killer leverage schemas,
bricks-and-clicks deploy markets,
world-class unleash platforms
$randomBsAdjective 隨機(jī)的商務(wù)口語形容詞 viral,24/7,24/365
$randomBsBuzz 隨機(jī)企業(yè)說流行語 repurpose,harness,transition
$randomBsNoun 隨機(jī)說話 e-servicesmarkets,interfaces

標(biāo)語(警句)

變量名稱 描述 例子
$randomCatchPhrase 隨機(jī)的流行語 Future-proofed heuristic open architecture,
Quality-focused executive toolset
Grass-roots real-time definition
$randomCatchPhraseAdjective 隨機(jī)的流行語形容詞 Self-enablingBusiness-focused,Down-sized
$randomCatchPhraseDescriptor 隨機(jī)標(biāo)語描述符 bandwidth-monitoredneeds-based,homogeneous
$randomCatchPhraseNoun 隨機(jī)生成一個流行短語 secured linesuperstructure,installation

數(shù)據(jù)庫

變量名稱 描述 例子
$randomDatabaseColumn 隨機(jī)數(shù)據(jù)庫列名稱 updatedAt,token,group
$randomDatabaseType 隨機(jī)數(shù)據(jù)庫類型 tinyint, text
$randomDatabaseCollation 隨機(jī)數(shù)據(jù)庫排序規(guī)則 cp1250_bin,utf8_general_cicp1250_general_ci
$randomDatabaseEngine 隨機(jī)數(shù)據(jù)庫引擎 MyISAMInnoDB,Memory

日期

變量名稱 描述 例子
$randomDateFuture 未來的隨機(jī)日期時間 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 隨機(jī)過去的日期時間 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 最近的隨機(jī)日期時間 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 隨機(jī)工作日 Thursday,FridayMonday
$randomMonth 隨機(jī)月份 February,May,January

域,電子郵件和用戶名

變量名稱 描述 例子
$randomDomainName 隨機(jī)域名 gracie.bizarmando.biz,trevor.info
$randomDomainSuffix 隨機(jī)域后綴 orgnet,com
$randomDomainWord 隨機(jī)的不合格域名 gwen,jadendonnell
$randomEmail 隨機(jī)電子郵件地址 Pablo62@gmail.com,Ruthe42@hotmail.comIva.Kovacek61@hotmail.com
$randomExampleEmail 來自“示例”域的隨機(jī)電子郵件地址 Talon28@example.com,Quinten_Kerluke45@example.netCasey81@example.net
$randomUserName 隨機(jī)用戶名 Jarrell.GutkowskiLottie.Smitham24,Alia99
$randomUrl 隨機(jī)網(wǎng)址 https://anais.net,https://tristin.net,http://jakob.name

文件和目錄

變量名稱 描述 例子
$randomFileName 隨機(jī)文件名(包括不常見的擴(kuò)展名) neural_sri_lanka_rupee_gloves.gdoc
plastic_awesome_garden.tif,
incredible_ivory_agent.lzh
$randomFileType 隨機(jī)文件類型(包括不常見的文件類型) modelapplication,video
$randomFileExt 隨機(jī)文件擴(kuò)展名(包括不常見的擴(kuò)展名) war,book,fsc
$randomCommonFileName 隨機(jī)文件名 well_modulated.mpg4,
rustic_plastic_tuna.gif,
checking_account_end_to_end_robust.wav
$randomCommonFileType 隨機(jī)的常見文件類型 application, audio
$randomCommonFileExt 隨機(jī)的通用文件擴(kuò)展名 m2v,wav,png
$randomFilePath 隨機(jī)文件路徑 /home/programming_chicken.cpio
/usr/obj/fresh_bandwidth_monitored_beauty.onetoc,
/dev/css_rustic.pm
$randomDirectoryPath 隨機(jī)目錄路徑 /usr/bin,/root,/usr/local/bin
$randomMimeType 隨機(jī)MIME類型 audio/vnd.vmx.cvsd
application/vnd.groove-identity-message
application/vnd.oasis.opendocument.graphics-template

商店

變量名稱 描述 例子
$randomPrice 100.00至999.00之間的隨機(jī)價格 531.55,488.76511.56
$randomProduct 隨機(jī)產(chǎn)品 Towels,Pizza,Pants
$randomProductAdjective 隨機(jī)產(chǎn)品形容詞 Unbranded,IncredibleTasty
$randomProductMaterial 隨機(jī)產(chǎn)品材料 SteelPlasticFrozen
$randomProductName 隨機(jī)產(chǎn)品名稱 Handmade Concrete TunaRefined Rubber Hat
$randomDepartment 隨機(jī)貿(mào)易類別 ToolsMovies,Electronics

英語語法

變量名稱 描述 例子
$randomNoun 隨機(jī)名詞 matrixbus,bandwidth
$randomVerb 隨機(jī)動詞 parsequantify,navigate
$randomIngverb 以“ -ing”結(jié)尾的隨機(jī)動詞 synthesizing,navigatingbacking up
$randomAdjective 隨機(jī)形容詞 auxiliary,multi-byte,back-end
$randomWord 隨機(jī)詞 withdrawal,infrastructuresIB
$randomWords 一些隨機(jī)的單詞 Samoa Synergistic sticky copying Grocery
Corporate Springs
Christmas Island Ghana Quality
$randomPhrase 隨機(jī)短語 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!

文本內(nèi)容(亂數(shù)假文)

變量名稱 描述 例子
$randomLoremWord 文本的隨機(jī)單詞 est
$randomLoremWords 文本的一些隨機(jī)詞 vel repellat nobis
$randomLoremSentence 文本的隨機(jī)句子 Molestias consequuntur nisi non quod.
$randomLoremSentences 文本的2-6個隨機(jī)句子 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 文本的隨機(jī)段落 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個隨機(jī)段落 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 隨機(jī)數(shù)量的文本 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 隨機(jī) URL段 eos-aperiam-accusamus,beatae-id-molestiae,qui-est-repellat
$randomLoremLines 1-5隨機(jī)行 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/

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容