Pre-request Script
隨機獲取數組里面的幾個值中的一個
var string = "10,20,25,50,75,100";
var array = string.split(","); //字符串轉換成數組
var value = array[Math.round(Math.random()*(array.length-1))];
postman.setEnvironmentVariable("size", value);
隨機整數
postman.setEnvironmentVariable("pageNumber", parseInt(Math.random()*1));
unix時間戳
postman.setEnvironmentVariable('timestamp',Math.round(new Date().getTime()/1000) );
Tests斷言
tests["HttpStatus code is 200"] = responseCode.code === 200;
tests["Response time is less than 300ms"] = responseTime < 300;
var jsonData = JSON.parse(responseBody);
tests["response statusCode"] = jsonData.code === 200;
tests["response message"] = jsonData.status === "SUCCESS";
最后編輯于 :2017.12.06 07:05:55
?著作權歸作者所有,轉載或內容合作請聯系作者 平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。