接口自动化之响应断言

1、assert断言(

assert r.status_code == 200

 

2、jsonPATH断言(

assert jsonpath(r.json(), '$..name')[0] == "开源项目"

3、xml断言

4、hamcrest断言体系(

assert_that(r.json()["category_list"]["categories"][0]["name"], equal_to( "开源项目"))

5、schema校验(

SchemaUnexpectedTypeError: '10' should be instance of 'int'

posted @ 2021-11-09 21:57  皮子成  阅读(303)  评论(0)    收藏  举报