/**
* Got EPC token and ret as global variables;
*/
var res = JSON.parse(responseBody);
pm.globals.set("apiToken", res.egPrincipalToken);
pm.globals.set("egPrincipalToken", res.egPrincipalToken);
console.log(res);
// assert test
pm.test("api response test", function() {
console.log("aaa");
pm.expect(pm.response.text()).to.include("apiToken");
pm.expect(pm.response.text()).to.include("egPrincipalToken");
})
Refer: https://www.cnblogs.com/ZhengYing0813/p/11693785.html