文章加密

;

2019年8月7日 星期三

Postman - 後端工程師用來測試 API的神器, runner iteration

https://dotblogs.com.tw/kinanson/2015/11/07/153838     →得出這是後端工程師在測試使用的,前端不需要他

https://ithelp.ithome.com.tw/articles/10201503


runner iteration 操作說明:
  1. + New Collection 
  2. Add Request 
  3. 編輯該request,如url, 測試環境
  4. 寫遞迴時的測試
    const FIRST_ON_LINE_REGION = ["global", "de", "pl", "se", "dk", "cz", "it", "hu", "fi", "pt", "es", "fr", "nl", "be-fr", "be-nl"];
    const OTHER_REGION = ["bt", "me-en", "lk", "in", "tr", "tw", "bd", "cn", "hk", "vn", "kr", "jp", "ru", "th", "sg", "nz", "ph", "id", "au", "my", "br", "latin", "no", "uk", "sk", "ch-fr", "ch-it", "ch-de", "ro", "rs", "ua", "gr", "za", "ca-fr", "ca-en", "us", "me-ar", "mx", "bg", "ie", "il", "ea", "middleeast-fa", "eg", "ua-ua", "nafr-ar", "africa-fr", "np", "wa", "middleeast-fa", "lt", "lv", "ee", "kz", "mm", "eg-en", "hk-en", "co", "cl", "ar", "pe", "ea-sw", "ch-en", "bn", "gr-el", ""];
    const REGION_LIST = FIRST_ON_LINE_REGION.concat(OTHER_REGION);
    pm.environment.set("countryname", REGION_LIST[pm.info.iteration]);
    // pm.info.iteration
    pm.test("Successful GET request - "+ REGION_LIST[pm.info.iteration -1] || "NO", function () {
    pm.expect(pm.response.code).to.be.oneOf([200,201,202]);
    });
  5. 用runner跑遞迴

沒有留言:

張貼留言