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');
});
截图