apipost 如何设置断言
前言
apipost断言是JavaScript语言编写的,在apipost客户端后执行脚本处即可。断言会在请求返回之后,运行,并根据断言的pass\fail情况体现在最终测试结果中。
一、首先编写一个接口请求
编写一个登录请求、发送请求。获得响应值。

二、编辑断言
找到apipost的后执行脚本,点击进入后执行脚本功能。

可以选择右侧导航栏提供的断言,比如判断是否返回的是json格式、响应码是否是200等

再次发送请求,查看断言设置

因为apipost的断言是 JavaScript语言编写的,所以我们可以自定义断言。
比如设置响应码是否为500,响应时间是否小于200ms

这就是apipost接口测试工具设置断言的步骤了。
工具下载地址:https://www.apipost.cn
评论