py+requests接口

断言:

assert res_login4.status_code == 200, "状态码不为200"
assert res_login4.json()["result"] == 1, "结果不为1"
assert res_login4.json()["data"] is not None, "data结果为空"
assert res_login4.json()["data"]["noDefaultOps"] is True, "结果为真"

#pytest框架有自带断言方法?

#postman断言(有两种方式?)

tests["Status Code is 200"] = responseCode.code === 200

var a = JSON.parse(responseBody);

tests["responseBody 'success' if true"]=a.success===true

tests["responseBody 'total' is not 0"]=a.data !=null

tests["responseBody 'message' is success"]=a.message==='作业提交成功记录变更信息成功'

猜你喜欢

转载自blog.csdn.net/u011381797/article/details/114522668