欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Postman內(nèi)建變量常用方法實例解析

 更新時間:2020年07月28日 11:24:40   作者:安琪兒一直在  
這篇文章主要介紹了Postman內(nèi)建變量常用方法實例解析,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下

一、Postman有以下內(nèi)建變量,適合一次性使用:

{{$guid}}//生成GUID
{{$timestamp}}//當(dāng)前時間戳
{{$randomInt}}//0-1000的隨機整數(shù)

二、內(nèi)建變量的應(yīng)用舉例,獲取當(dāng)前時間戳

// 隨機整數(shù)
const randomInt = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min; 
pm.globals.set("random_number", randomInt(300,1000));
 

//從多個選項中選擇實現(xiàn):
const randomInt = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min; 
const getRandomValue = list => list[randomInt(0, list.length - 1)];
const charsInName = ['王','李','張'];
pm.globals.set("people_name", getRandomValue(charsInName));

//隨機生成手機號
const randomInt = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min; 
var mobile_num= `18${randomInt(100000000, 999999999)}`;
pm.globals.set("mobile_num", mobile_num);

//等待
const sleep = (milliseconds) => {
const start = Date.now();
while (Date.now() <= start + milliseconds) {}
};
sleep(5000)  //5秒

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論