Postman內(nèi)建變量常用方法實(shí)例解析
一、Postman有以下內(nèi)建變量,適合一次性使用:
{{$guid}}//生成GUID
{{$timestamp}}//當(dāng)前時(shí)間戳
{{$randomInt}}//0-1000的隨機(jī)整數(shù)
二、內(nèi)建變量的應(yīng)用舉例,獲取當(dāng)前時(shí)間戳
// 隨機(jī)整數(shù) const randomInt = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min; pm.globals.set("random_number", randomInt(300,1000)); //從多個(gè)選項(xiàng)中選擇實(shí)現(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)); //隨機(jī)生成手機(jī)號(hào) 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)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- Postman動(dòng)態(tài)獲取返回值過程詳解
- Postman如何實(shí)現(xiàn)參數(shù)化執(zhí)行及斷言處理
- 如何在postman測試用例中實(shí)現(xiàn)斷言過程解析
- 如何在postman中添加cookie信息步驟解析
- postman中POST請(qǐng)求時(shí)參數(shù)包含參數(shù)list設(shè)置方式
- postman和python mock測試過程圖解
- postman傳遞當(dāng)前時(shí)間戳實(shí)例詳解
- postman模擬訪問具有Session的post請(qǐng)求方法
- Postman無法正常返回結(jié)果問題解決
相關(guān)文章
JavaScript之class繼承_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理
這篇文章主要介紹了JavaScript之class繼承,新的關(guān)鍵字class從ES6開始正式被引入到JavaScript中。class的目的就是讓定義類更簡單,有興趣的可以了解一下2017-07-07使用遞歸遍歷對(duì)象獲得value值的實(shí)現(xiàn)方法
下面小編就為大家?guī)硪黄褂眠f歸遍歷對(duì)象獲得value值的實(shí)現(xiàn)方法。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2016-06-06vue3 uniapp微信登錄功能實(shí)現(xiàn)
根據(jù)最新的微信小程序官方的規(guī)定,uniapp中的uni.getUserInfo方法不再返回用戶頭像和昵稱、以及手機(jī)號(hào),這篇文章主要介紹了vue3 uniapp微信登錄功能實(shí)現(xiàn),需要的朋友可以參考下2024-04-04layui-table表復(fù)選框勾選的所有行數(shù)據(jù)獲取的例子
今天小編就為大家分享一篇layui-table表復(fù)選框勾選的所有行數(shù)據(jù)獲取的例子,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2019-09-09