1、chai.js的API地址
postman之chai:https://www.chaijs.com/api/
postman之cookie:http://www.postmanlabs.com/postman-collection/CookieList.html#get
postman官方文檔:https://learning.getpostman.com/docs/postman/environments-and-globals/manage-environments/
postman連接mysql:https://github.com/o1lab/xmysql#setup-and-usage
postman內置模塊列表:https://learning.getpostman.com/docs/postman/scripts/postman-sandbox-api-reference/
2、chai.js有兩種風格:BDD、TDD
postman對BDD風格進行了重新封裝,在使用時,需要在方法之前加上pm,並且用戶在postman中使用腳本時,通常需要統計pass和fail的接口數量,所以在postman中使用斷言需要放在pm.test()方法中,不在pm.test()方法中使用的話,即便斷言失敗,也不會統計數量。
示例:
pm.test("Check if pattern is in target string",function () {
pm.expect.fail('11');
});
3、在postman的腳本中依然可以使用原生的BDD和TDD
示例
var assert = require('chai').assert;
var expect = require('chai').expect;
pm.test("Body is correct", function () {
assert.isOk('1','');
});
pm.test("Check if pattern is in target string",function () {
expect.fail('22');
});
截圖