# 结构化响应断言JSON XML
# Json断言
def test_hogwarts(self):
url="https://home.testing-studio.com/categories.json"
r = requests.get(url)
assert r.json()['category_list']['categories'][0]['name'] == '提问区'
1
2
3
4
2
3
4
# Json path断言
def testhogwartsjsonpath(self)
url="https://home.testing-studio.com/categories.json"
r = requests.get(url)
assert jsonpath(r.json(), '$..name')[0] == '提问区'
1
2
3
4
2
3
4
# jsonpath的类型
