1.首先在postman新建要批量運行的接口文件夾,新建一個接口,並設置好全局變量。
2.然后在Test里面設置好要斷言的方法
如:
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
pm.test("Body matches string", function () {
pm.expect(pm.response.text()).to.include("success");
});
3.保存后,點擊Runner,選擇剛才新建的文件夾,設置好迭代和測試環境
4.步驟一中設置的接口全局變量是keyword,我們在每次迭代中給這個變量賦值,就需要用到csv(txt)或者json文件,如我用的txt文件
5.在Runner中選擇該txt文件,點擊preview預覽效果:
6.配置好后,點擊start test,即可看到運行結果