basic-auto-test/test_case/test_demo_api.py

22 lines
799 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# -*- 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