22 lines
799 B
Python
22 lines
799 B
Python
# -*- coding: utf-8 -*-
|
||
# -------------------------------
|
||
# @文件:test_demo_api.py
|
||
# @时间:2024/5/10 上午9:57
|
||
# @作者:caiweichao
|
||
# @功能描述:restful接口测试 demo
|
||
# -------------------------------
|
||
import pytest
|
||
|
||
from util.auto_test.api_test.analysis_restful_testcase import AnalysisRestfulTestCase
|
||
from util.auto_test.api_test.response_assert import ResponseAssert
|
||
from util.auto_test.api_test.basic_request import *
|
||
|
||
|
||
# 测试用例参数化解析
|
||
@pytest.mark.parametrize("testcase", AnalysisRestfulTestCase("demo_service/demo_api.yaml").analysis_testcase())
|
||
def test_demo_api(testcase: ApiTestCase):
|
||
# 发起接口测试请求
|
||
response = ApiTestRequest(testcase).get_response()
|
||
# 断言校验
|
||
assert ResponseAssert(testcase, response).assert_data() is True
|