添加小程序商城首页测试用例
This commit is contained in:
parent
ea3caea2c5
commit
972aae073b
|
@ -0,0 +1,49 @@
|
|||
case_common:
|
||||
allureEpic: JekunAuto小程序接口
|
||||
allureFeature: 商城模块
|
||||
allureStory: 商城模块
|
||||
|
||||
platform_index_01:
|
||||
host: ${{host()}}
|
||||
url: /v1/category/platform-index
|
||||
method: GET
|
||||
detail: 商城主页
|
||||
headers:
|
||||
Connection: 'keep-alive'
|
||||
clientSource: '0'
|
||||
areaCode: '440105'
|
||||
content-type: 'application/json'
|
||||
Cookie: '_csrf-frontend=d096dba5839b9b40dbe5272fc4e4957f6b1b184d8fb7eaebc21cd75627ef2bffa%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%2293xDpdFnQnR8bB2icCtVFXIALxa_KJzO%22%3B%7D; advanced-frontend=m5ls5co6orfgd1r2147cild98g'
|
||||
# 这里cookie的值,写的是存入缓存的名称
|
||||
# 请求的数据,是 params 还是 json、或者file、data
|
||||
requestType: params
|
||||
# 是否执行,空或者 true 都会执行
|
||||
is_run:
|
||||
data:
|
||||
fields: "id,categoryName,childCategories"
|
||||
thirdPartySource: JEKUNAUTO
|
||||
clientSource: "0"
|
||||
dependence_case: True
|
||||
# 依赖的数据
|
||||
dependence_case_data:
|
||||
- case_id: user_info_01
|
||||
dependent_data:
|
||||
- dependent_type: response
|
||||
jsonpath: $.data[userId]
|
||||
set_cache: userId
|
||||
- dependent_type: response
|
||||
jsonpath: $.data[accessId]
|
||||
set_cache: accessId
|
||||
- dependent_type: response
|
||||
jsonpath: $.data[accessKey]
|
||||
set_cache: accessKey
|
||||
|
||||
assert:
|
||||
# 断言接口状态码
|
||||
status_code: 200
|
||||
data:
|
||||
jsonpath: $.data[0].categoryName
|
||||
type: ==
|
||||
value: "车身护理"
|
||||
AssertType:
|
||||
sql:
|
|
@ -179,5 +179,4 @@ user_info_car_01:
|
|||
assert:
|
||||
# 断言接口状态码
|
||||
status_code: 200
|
||||
|
||||
sql:
|
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# @Time : 2023-02-21 17:00:49
|
||||
|
||||
|
||||
import allure
|
||||
import pytest
|
||||
from utils.read_files_tools.get_yaml_data_analysis import GetTestCase
|
||||
from utils.assertion.assert_control import Assert
|
||||
from utils.requests_tool.request_control import RequestControl
|
||||
from utils.read_files_tools.regular_control import regular
|
||||
from utils.requests_tool.teardown_control import TearDownHandler
|
||||
|
||||
|
||||
case_id = ['platform_index_01']
|
||||
TestData = GetTestCase.case_data(case_id)
|
||||
re_data = regular(str(TestData))
|
||||
|
||||
|
||||
@allure.epic("JekunAuto小程序接口")
|
||||
@allure.feature("商城模块")
|
||||
class TestPlatformIndex:
|
||||
|
||||
@allure.story("商城模块")
|
||||
@pytest.mark.parametrize('in_data', eval(re_data), ids=[i['detail'] for i in TestData])
|
||||
def test_platform_index(self, in_data, case_skip):
|
||||
"""
|
||||
:param :
|
||||
:return:
|
||||
"""
|
||||
res = RequestControl(in_data).http_request()
|
||||
TearDownHandler(res).teardown_handle()
|
||||
Assert(in_data['assert_data']).assert_equality(response_data=res.response_data,
|
||||
sql_data=res.sql_data, status_code=res.status_code)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
pytest.main(['test_platform_index.py', '-s', '-W', 'ignore:Module already imported:pytest.PytestWarning'])
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# @Time : 2023-02-15 17:45:07
|
||||
# @Time : 2023-02-21 17:00:49
|
||||
|
||||
|
||||
import allure
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# @Time : 2023-02-15 17:45:07
|
||||
# @Time : 2023-02-21 17:00:49
|
||||
|
||||
|
||||
import allure
|
||||
|
|
|
@ -4,6 +4,7 @@ from typing import Text, Dict, Callable, Union, Optional, List, Any
|
|||
from dataclasses import dataclass
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class NotificationType(Enum):
|
||||
""" 自动化通知方式 """
|
||||
DEFAULT = 0
|
||||
|
@ -36,6 +37,7 @@ class RequestType(Enum):
|
|||
EXPORT = "EXPORT"
|
||||
NONE = "NONE"
|
||||
|
||||
|
||||
# TODO 为什么判断下是否有方法
|
||||
def load_module_functions(module) -> Dict[Text, Callable]:
|
||||
""" 获取 module中方法的名称和所在的内存地址
|
||||
|
@ -222,7 +224,7 @@ class AllureAttachmentType(Enum):
|
|||
|
||||
PDF = "pdf"
|
||||
|
||||
|
||||
# todo 分析断言,增加断言种类
|
||||
@unique
|
||||
class AssertMethod(Enum):
|
||||
"""断言类型"""
|
||||
|
|
|
@ -386,7 +386,7 @@ class RequestControl:
|
|||
allure_step("响应结果: ", res)
|
||||
|
||||
@log_decorator(True)
|
||||
@execution_duration(3000)
|
||||
@execution_duration(5000)
|
||||
# @encryption("md5")
|
||||
def http_request(
|
||||
self,
|
||||
|
|
Loading…
Reference in New Issue