接口测试的时候,有时候会对接口进行断言,apipost在后执行脚本中提供了断言功能
apt.assert('response.raw.responseText=="test"');
apt.assert('response.raw.status==200');
apt.assert('response.raw.type=="json"');
apt.assert('response.raw.responseTime>=100');
apt.assert('response.json.errcode==1');
apt.assert('response.json.errcode!=1');
apt.assert('response.json.errcode>=1');
apt.assert('response.json.errcode==null');
apt.assert('response.json.errcode!=null');
apt.assert('response.headers["server"] == "nginx"');
apt.assert('response.headers["content-encoding"] == "gzip"');
还可以自定义其他的值,在把data设置为断言