1. HTTP状态码断言:tests["Http状态码200"] = responseCode.code == 200;
2. 响应包含内容断言:tests["状态码200"] = responseBody.has("登录成功");
示例如下:
URL:https://demo.fastadmin.net/admin/index/login.html
用户名/密码:admin/123456
3. JSON响应断言:
var jsonData = JSON.parse(responseBody);
tests["code = 100000表示成功"] = jsonData.code ==100000
tests["msg为success"] = jsonData.msg == "success"
示例如下:
URL:http://www.tuling123.com/openapi/api?key=ec961279f453459b9248f0aeb6600bbe&info=你好
转自:https://www.jianshu.com/p/4b374b4556c5
以上
2019.01.14