Commit 3953ce2e by yyr

接口自动化框架—v1.2

parent 15634d65
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="py.test" />
</component>
</module>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredIdentifiers">
<list>
<option value="study_pytest.apiAutoTest_v1.common.read_excel.ReadExcel.read_json" />
</list>
</option>
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/apiAutoTest_v3.iml" filepath="$PROJECT_DIR$/.idea/apiAutoTest_v3.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="97d18fb3-53a6-401a-befb-7adb5a601747" name="更改" comment="" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ProjectColorInfo"><![CDATA[{
"associatedIndex": 6
}]]></component>
<component name="ProjectId" id="2locKNrF5JeKsXJi1RxFqy0C7FV" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.ShowReadmeOnStart": "true",
"last_opened_file_path": "D:/projects/python312/pythonProject/self_copy/apiAutoTest_v3"
}
}]]></component>
<component name="SharedIndexes">
<attachedChunks>
<set>
<option value="bundled-python-sdk-975db3bf15a3-31b6be0877a2-com.jetbrains.pycharm.community.sharedIndexes.bundled-PC-241.18034.82" />
</set>
</attachedChunks>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="应用程序级" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="默认任务">
<changelist id="97d18fb3-53a6-401a-befb-7adb5a601747" name="更改" comment="" />
<created>1725849805401</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1725849805401</updated>
</task>
<servers />
</component>
</project>
\ No newline at end of file
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: pythonProject
# FileName: __init__.py
# Author: toast
# Datetime: 2024/9/7 上午9:14
# Description:
#
# ---------------------------------------------------------------------------
import logging
import os
import time
def log(name="toast"):
logger = logging.getLogger(name)
logger.level = logging.INFO
log_name = time.strftime("%Y-%m-%d_%H-%M-%S", time.localtime()) + ".log"
log_dir = os.path.join(os.path.join(os.path.dirname(__file__),"report"),"log")
log_path = os.path.join(log_dir, log_name)
handle = logging.FileHandler(log_path, mode="a", encoding="utf-8")
formatter = logging.Formatter('%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s -- %(name)s')
handle.setFormatter(formatter)
logger.addHandler(handle)
return logger
log = log()
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: pythonProject
# FileName: __init__.py
# Author: toast
# Datetime: 2024/9/7 上午10:08
# Description:
#
# ---------------------------------------------------------------------------
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: pythonProject
# FileName: db.py
# Author: toast
# Datetime: 2024/9/7 上午10:08
# Description:
#
# ---------------------------------------------------------------------------
import pymysql
from apiAutoTest_v3 import log
from apiAutoTest_v3.common.read_project_ini import ReadProjectIni
class DB:
def __init__(self):
pro_ini = ReadProjectIni()
self.conn = pymysql.connect(
host= pro_ini.get_sql_connect_msg("host"),
port=int(pro_ini.get_sql_connect_msg("port")),
user=pro_ini.get_sql_connect_msg("user"),
password=pro_ini.get_sql_connect_msg("password"),
database=pro_ini.get_sql_connect_msg("database"),
charset="utf8"
)
self.cursor =self.conn.cursor()
def close(self):
self.cursor.close()
self.conn.close()
def select(self,sql,n=0):
if isinstance(sql,str):
if sql.strip().lower().startswith("select"):
try:
self.cursor.execute(sql)
except Exception as e:
log.error(f"执行select方法时,产生错误,sql语句为:{sql},错误为:{e}")
return e
else:
select_result = self.cursor.fetchall()
if isinstance(n,int) and select_result:
try:
return select_result[n][0]
except Exception as e:
log.error(f"执行select方法时,获取查询结果失败,传入的n为:{n}")
else:
log.error(f"执行select方法时,sql语句不是查询你的sql语句,sql语句为:{sql}")
raise ValueError("sql语句错误")
else:
log.error(f"执行select方法时,sql语句错误,sql语句为:{sql}")
raise ValueError("sql语句错误")
def delete(self,sql):
if isinstance(sql,str):
if sql.strip().lower().startswith("delete"):
try:
self.cursor.execute(sql)
self.conn.commit()
except Exception as e:
log.error(f"执行delete方法时,产生错误,sql语句为:{sql},错误为:{e}")
raise e
else:
log.error(f"执行delete方法时,sql语句错误,sql语句为:{sql}")
raise ValueError("sql语句错误")
else:
log.error(f"执行delete方法时,sql语句错误,sql语句为:{sql}")
raise ValueError("sql语句错误")
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: pythonProject
# FileName: read_excel.py
# Author: toast
# Datetime: 2024/9/7 上午11:02
# Description:
#
# ---------------------------------------------------------------------------
import openpyxl
from apiAutoTest_v3 import log
from apiAutoTest_v3.common.read_json import read_json
from apiAutoTest_v3.common.read_project_ini import ReadProjectIni
from apiAutoTest_v3.common.read_user_ini import ReadUserIni
from apiAutoTest_v3.data_config.settings import *
class ReadExcel:
def __init__(self,user_dir_name):
self.pro_ini = ReadProjectIni()
user_ini = ReadUserIni(user_dir_name)
case_data_path = user_ini.get_file_path(FILE_CASE)
expect_data_path = user_ini.get_file_path(FILE_EXPECT)
sql_data_path = user_ini.get_file_path(FILE_SQL)
excel_path = user_ini.get_file_path(FILE_EXCEL)
table_name = user_ini.get_table_name(TABLE_KEY)
self.case_data_dict = read_json(case_data_path)
self.expect_data_dict = read_json(expect_data_path)
self.sql_data_dict = read_json(sql_data_path)
try:
wb = openpyxl.load_workbook(excel_path)
self.ws = wb[table_name]
except Exception as e:
log.error(f"加载excel工作簿/获取excel工作表时产生错误,错误为:{e},excel的路径为:{excel_path},工作表名称为:{table_name}")
raise e
def __get_cell_value(self,column,row):
try:
cell_value = self.ws[column + str(row)].value
except Exception as e:
log.error(f"获取单元格数据失败,错误为:{e},列号为:{column},行号为:{row}")
raise e
else:
if cell_value is None:
return None
elif cell_value.strip():
return cell_value.strip()
def moduel_name(self,row):
return self.__get_cell_value(MODULE,row)
def api_name(self,row):
return self.__get_cell_value(API,row)
def case_url(self,row):
path = self.__get_cell_value(URL,row)
if path:
return self.pro_ini.get_host(HOST_KEY)+path
def case_req_method(self,row):
return self.__get_cell_value(REQ_METHOD,row)
def case_mime(self,row):
mime = self.__get_cell_value(MIME,row)
if mime:
return mime.lower()
def case_data(self,row):
case_data_key = self.__get_cell_value(CASE_DATA,row)
if case_data_key:
module_name = self.moduel_name(row)
api_name = self.api_name(row)
return self.case_data_dict[module_name][api_name][case_data_key]
def expect_data(self,row):
expect_data_key = self.__get_cell_value(EXPECT_DATA,row)
if expect_data_key:
module_name = self.moduel_name(row)
api_name = self.api_name(row)
return self.expect_data_dict[module_name][api_name][expect_data_key]
def sql_data(self,row):
sql_data_key = self.__get_cell_value(SQL_DATA,row)
if sql_data_key:
module_name = self.moduel_name(row)
api_name = self.api_name(row)
return self.sql_data_dict[module_name][api_name][sql_data_key]
def sql_type(self,row):
sql_type = self.__get_cell_value(SQL_TYPE,row)
if sql_type:
return sql_type.lower()
def update_data(self,row):
return self.__get_cell_value(UPDATE_KEY,row)
def case_title(self,row):
return self.__get_cell_value(TITLE,row)
def case_level(self,row):
return self.__get_cell_value(LEVEL,row)
def get_data(self):
list_data = []
for row in range(2,self.ws.max_row+1):
module_name = self.moduel_name(row)
api_name = self.api_name(row)
title = self.case_title(row)
level = self.case_level(row)
url = self.case_url(row)
method = self.case_req_method(row)
mime = self.case_mime(row)
case_data = self.case_data(row)
expect_data = self.expect_data(row)
sql_type = self.sql_type(row)
sql_data = self.sql_data(row)
update_data = self.update_data(row)
if url is not None and method is not None and expect_data is not None:
list_data.append([module_name,api_name,title,level,url,method,mime,case_data,expect_data,sql_type,sql_data,update_data])
return list_data
if __name__ == '__main__':
E = ReadExcel('toast')
print(E.sql_data(16))
# print(E.get_data())
\ No newline at end of file
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: pythonProject
# FileName: read_json.py
# Author: toast
# Datetime: 2024/9/7 上午10:55
# Description:
#
# ---------------------------------------------------------------------------
import json
from apiAutoTest_v3 import log
def read_json(file_path):
if isinstance(file_path, str):
try:
with open(file_path,mode="r",encoding="utf-8") as f:
return json.load(f)
except Exception as e:
log.error(f"读取json文件失败,传入的文件路径为:{file_path}-可能文件路径不存在/数据格式错误,错误为:{e}")
raise e
else:
log.error(f"执行read_json方法失败,传入的文件路径:{file_path}-不为字符串")
raise ValueError("传入文件路径必须为字符串")
\ No newline at end of file
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: pythonProject
# FileName: read_project_ini.py
# Author: toast
# Datetime: 2024/9/7 上午10:09
# Description:
#
# ---------------------------------------------------------------------------
import configparser
import os
from apiAutoTest_v3 import log
class ReadProjectIni:
def __init__(self):
self.data_config = os.path.join(os.path.dirname(os.path.dirname(__file__)),"data_config")
ini_path = os.path.join(self.data_config,"project_config.ini")
self.conf = configparser.ConfigParser()
self.conf.read(ini_path,encoding="utf-8")
def get_host(self,key):
try:
return self.conf.get("host",key)
except Exception as e:
log.error(f"方法get_host执行失败,形参为key传参为:{key},错误为:{e}")
raise e
def get_sql_connect_msg(self,key):
try:
return self.conf.get("sql",key)
except Exception as e:
log.error(f"方法get_sql_connect_msg执行失败,形参为key传参为:{key},错误为:{e}")
raise e
if __name__ == '__main__':
ini = ReadProjectIni()
print(ini.get_host("host"))
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: pythonProject
# FileName: read_user_ini.py
# Author: toast
# Datetime: 2024/9/7 上午10:28
# Description:
#
# ---------------------------------------------------------------------------
import configparser
import os
from apiAutoTest_v3 import log
class ReadUserIni:
def __init__(self,user_dir_name):
data_config = os.path.join(os.path.dirname(os.path.dirname(__file__)),"data_config")
self.user_dir = os.path.join(data_config,user_dir_name)
ini_path = os.path.join(self.user_dir,"config.ini")
self.conf = configparser.ConfigParser()
self.conf.read(ini_path,encoding="utf-8")
def get_file_path(self,key):
try:
log.info(f"执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为{key}")
file_name = self.conf.get("file",key)
except Exception as e:
log.error(f"方法get_file_path执行失败,传入形参key值为:{key},错误为:{e}")
raise e
else:
return os.path.join(self.user_dir,file_name)
def get_table_name(self,key):
try:
log.info(f"执行方法get_table_name为根据key获取table节点下key对应表名,形参key的传参为{key}")
return self.conf.get("table",key)
except Exception as e:
log.error(f"方法get_table_name执行失败,传入形参key值为:{key},错误为:{e}")
raise e
{
"认证接口":{
"登录系统":{
"LoginSuccess": {"username": "admin","password": "bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ="},
"LoginErrorUsernameIsNone": {"username": "","password": "bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ="},
"LoginErrorUsernameIsSpecialChar": {"username": "#!$!@#!@#","password": "bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ="},
"LoginErrorUsernameIsLong": {"username": "adminadminadminadminadminadminadminadminadmin","password": "bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ="},
"LoginErrorUsernameIsShort": {"username": "a","password": "bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ="},
"LoginErrorUsernameIsError": {"username": "adminxyz","password": "bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ="},
"LoginErrorPasswordIsNone": {"username": "admin","password": ""},
"LoginErrorPasswordIsSpecialChar": {"username": "admin","password": "#!$!@#!@#"},
"LoginErrorPasswordIsLong": {"username": "admin","password": "bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jznbF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jznbF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jznbF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jznbF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn"},
"LoginErrorPasswordIsShort": {"username": "admin","password": "123456"},
"LoginErrorPasswordIsError": {"username": "admin","password": "bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ"}
}
},
"维度管理": {
"添加维度": {
"AddDemSuccess": {"code": "requestsAddDem","description": "requestsAddDem","isDefault": 1,"name": "requests添加的维度"}
},
"根据维度编码获取维度信息": {
"GetDemMessageSuccess": {"code": "requestsAddDem"}
},
"根据维度编码删除维度": {
"DeleteDemSuccess": {"ids": "需要更新"}
},
"更新维度": {
"UpdateDemSuccess": {
"code": "requestsAddDem",
"description": "requestsAddDem",
"isDefault": 0,
"name": "requestsAddDem"
}
}
},
"组织管理": {
"添加组织": {
"AddOrgSuccess": {
"code": "testAddOrg",
"demId": "需要更新",
"exceedLimitNum": 0,
"grade": "",
"limitNum": 0,
"name": "测试添加的组织",
"nowNum": 0,
"orderNo": 0,
"parentId": "0"
}
},
"用户加入组织": {
"OrgAddUserSuccess": {"orgCode": "testAddOrg", "accounts": "admin,guest"}
},
"保存组织参数": {
"SaveOrgparamsSuccess": {
"query": {"orgCode": "testAddOrg"},
"body": [{"alias": "hxxmts", "value": "项目中没有关系户"}]
}
},
"删除组织": {
"DeleteOrgSuccess": "testAddOrg"
}
}
}
{
"认证接口":{
"登录系统":{
"LoginSuccess": {"username":"超级管理员","account":"admin","userId":"1","expiration":86400,"loginStatus":true},
"LoginErrorUsernameIsNone": {"message":"账号或密码错误"},
"LoginErrorUsernameIsSpecialChar": {"message":"账号或密码错误"},
"LoginErrorUsernameIsLong": {"message":"账号或密码错误"},
"LoginErrorUsernameIsShort": {"message":"账号或密码错误"},
"LoginErrorUsernameIsError": {"message":"账号或密码错误"},
"LoginErrorPasswordIsNone":{"message":"账号或密码错误"},
"LoginErrorPasswordIsSpecialChar": {"message":"账号或密码错误"},
"LoginErrorPasswordIsLong": {"message":"账号或密码错误"},
"LoginErrorPasswordIsShort": {"message":"账号或密码错误"},
"LoginErrorPasswordIsError":{"message":"账号或密码错误"}
},
"刷新token": {
"RefreshSuccess": {"message": "刷新token成功"}
}
},
"维度管理": {
"添加维度": {
"AddDemSuccess": {"message": "添加维度成功"}
},
"根据维度编码获取维度信息": {
"GetDemMessageSuccess": {"isDelete": "0"}
},
"根据维度编码删除维度": {
"DeleteDemSuccess": {"message": "删除维度成功!"}
},
"更新维度": {
"UpdateDemSuccess": {"message": "更新维度成功"}
}
},
"组织管理": {
"添加组织": {
"AddOrgSuccess": {"message": "添加组织成功"}
},
"用户加入组织": {
"OrgAddUserSuccess": {"message":"加入成功"}
},
"保存组织参数": {
"SaveOrgparamsSuccess": {"message":"保存组织参数成功!"}
},
"删除组织": {
"DeleteOrgSuccess": {"message":"删除组织成功!"}
}
}
}
{
"维度管理": {
"添加维度": {
"AddDemSuccess": {"delete": "dELETE FROM uc_demension WHERE `CODE_`=\"requestsAddDem\";"}
},
"根据维度编码删除维度": {
"DeleteDemSuccess": {"select": "select ID_ from uc_demension where CODE_=\"requestsAddDem\";"}
}
},
"组织管理": {
"添加组织": {
"AddOrgSuccess": {
"select": "select ID_ from uc_demension where CODE_=\"requestsAddDem\"; ",
"delete": "delete from uc_org where CODE_=\"testAddOrg\";"
}
}
}
}
[file]
# 配置数据配置层中文件的名称
excel=bread.xlsx
case=bread_case_data.json
expect=bread_expect_data.json
sql=bread_sql_data.json
[table]
# 配置工作表名称
table_name=BPM
#存放公共的数据
[host]
bpm_host = http://36.139.193.99:8088
[sql]
host = 36.139.193.99
port = 3306
user = root
password = Rhrc@2024
database = eip8
[report]
log = log
\ No newline at end of file
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: pythonProject
# FileName: settings.py
# Author: toast
# Datetime: 2024/9/7 上午9:33
# Description:
#
# ---------------------------------------------------------------------------
#excel列号
NUMBER = "A"
MODULE = "B"
API = "C"
TITLE = "D"
LEVEL = "E"
URL = "F"
REQ_METHOD = "G"
MIME = "H"
CASE_DATA = "I"
EXPECT_DATA = "J"
SQL_TYPE = "K"
SQL_DATA = "L"
UPDATE_KEY = "M"
#ini文件中file节点的key
FILE_EXCEL = "excel"
FILE_CASE = "case"
FILE_EXPECT = "expect"
FILE_SQL = "sql"
#ini文件中host节点的key
HOST_KEY = "bpm_host"
#ini文件中table节点的key
TABLE_KEY = "table_name"
\ No newline at end of file
[file]
excel = toast.xlsx
case = toast_case_data.json
expect = toast_expect_data.json
sql = toast_sql_data.json
[table]
table_name = 登录和添加维度的用例
\ No newline at end of file
{
"认证接口":{
"登录系统":{
"LoginSuccess": {"username": "admin","password": "bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ="},
"LoginErrorUsernameIsNone": {"username": "","password": "bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ="},
"LoginErrorUsernameIsSpecialChar": {"username": "#!$!@#!@#","password": "bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ="},
"LoginErrorUsernameIsLong": {"username": "adminadminadminadminadminadminadminadminadmin","password": "bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ="},
"LoginErrorUsernameIsShort": {"username": "a","password": "bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ="},
"LoginErrorUsernameIsError": {"username": "adminxyz","password": "bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ="},
"LoginErrorPasswordIsNone": {"username": "admin","password": ""},
"LoginErrorPasswordIsSpecialChar": {"username": "admin","password": "#!$!@#!@#"},
"LoginErrorPasswordIsLong": {"username": "admin","password": "bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jznbF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jznbF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jznbF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jznbF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn"},
"LoginErrorPasswordIsShort": {"username": "admin","password": "123456"},
"LoginErrorPasswordIsError": {"username": "admin","password": "bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ"}
}
},
"维度管理": {
"添加维度": {
"AddDemSuccess": {"code": "requestsAddDem","description": "requestsAddDem","isDefault": 1,"name": "requests添加的维度"}
},
"根据维度编码获取维度信息": {
"GetDemMessageSuccess": {"code": "requestsAddDem"}
},
"根据维度编码删除维度": {
"DeleteDemSuccess": {"ids": "需要更新"}
}
}
}
\ No newline at end of file
{
"认证接口":{
"登录系统":{
"LoginSuccess": {"username":"超级管理员","account":"admin","userId":"1","expiration":86400,"loginStatus":true},
"LoginErrorUsernameIsNone": {"message":"账户错误或该租户未启用"},
"LoginErrorUsernameIsSpecialChar": {"message":"账户错误或该租户未启用"},
"LoginErrorUsernameIsLong": {"message":"账户错误或该租户未启用"},
"LoginErrorUsernameIsShort": {"message":"账户错误或该租户未启用"},
"LoginErrorUsernameIsError": {"message":"账户错误或该租户未启用"},
"LoginErrorPasswordIsNone":{"message":"账号或密码错误"},
"LoginErrorPasswordIsSpecialChar": {"message":"账号或密码错误"},
"LoginErrorPasswordIsLong": {"message":"解密密码异常,请检查RSA公钥和私钥配置"},
"LoginErrorPasswordIsShort": {"message":"解密密码异常,请检查RSA公钥和私钥配置"},
"LoginErrorPasswordIsError":{"message":"账号或密码错误"}
},
"刷新token": {
"RefreshSuccess": {"message": "刷新token成功"}
}
},
"维度管理": {
"添加维度": {
"AddDemSuccess": {"message": "添加维度成功"}
},
"根据维度编码获取维度信息": {
"GetDemMessageSuccess": {"isDelete": "0"}
},
"根据维度编码删除维度": {
"DeleteDemSuccess": {"message": "删除维度成功!"}
}
}
}
\ No newline at end of file
{
"维度管理": {
"添加维度": {
"AddDemSuccess": "dELETE FROM uc_demension WHERE `CODE_`=\"requestsAddDem\";"
},
"根据维度编码删除维度": {
"DeleteDemSuccess": "select ID_ from uc_demension where CODE_=\"requestsAddDem\";"
}
}
}
2024-09-07 16:56:58,470 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为case -- toast
2024-09-07 16:56:58,470 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为expect -- toast
2024-09-07 16:56:58,470 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为sql -- toast
2024-09-07 16:56:58,471 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为excel -- toast
2024-09-07 16:56:58,471 - read_user_ini.py[line:36] - INFO: 执行方法get_table_name为根据key获取table节点下key对应表名,形参key的传参为table_name -- toast
2024-09-07 16:56:58,472 - read_json.py[line:21] - ERROR: 读取json文件失败,传入的文件路径为:D:\projects\python312\pythonProject\self_copy\apiAutoTest_v3\data_config\toast\bread_case_data.json-可能文件路径不存在/数据格式错误,错误为:[Errno 2] No such file or directory: 'D:\\projects\\python312\\pythonProject\\self_copy\\apiAutoTest_v3\\data_config\\toast\\bread_case_data.json' -- toast
2024-09-07 17:01:38,051 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为case -- toast
2024-09-07 17:01:38,051 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为expect -- toast
2024-09-07 17:01:38,051 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为sql -- toast
2024-09-07 17:01:38,051 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为excel -- toast
2024-09-07 17:01:38,052 - read_user_ini.py[line:36] - INFO: 执行方法get_table_name为根据key获取table节点下key对应表名,形参key的传参为table_name -- toast
2024-09-07 17:01:38,052 - read_json.py[line:21] - ERROR: 读取json文件失败,传入的文件路径为:D:\projects\python312\pythonProject\self_copy\apiAutoTest_v3\data_config\toast\bread_case_data.json-可能文件路径不存在/数据格式错误,错误为:[Errno 2] No such file or directory: 'D:\\projects\\python312\\pythonProject\\self_copy\\apiAutoTest_v3\\data_config\\toast\\bread_case_data.json' -- toast
2024-09-07 17:02:48,930 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为case -- toast
2024-09-07 17:02:48,930 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为expect -- toast
2024-09-07 17:02:48,930 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为sql -- toast
2024-09-07 17:02:48,930 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为excel -- toast
2024-09-07 17:02:48,931 - read_user_ini.py[line:36] - INFO: 执行方法get_table_name为根据key获取table节点下key对应表名,形参key的传参为table_name -- toast
2024-09-07 17:02:48,931 - read_json.py[line:21] - ERROR: 读取json文件失败,传入的文件路径为:D:\projects\python312\pythonProject\self_copy\apiAutoTest_v3\data_config\toast\bread_case_data.json-可能文件路径不存在/数据格式错误,错误为:[Errno 2] No such file or directory: 'D:\\projects\\python312\\pythonProject\\self_copy\\apiAutoTest_v3\\data_config\\toast\\bread_case_data.json' -- toast
2024-09-07 17:04:58,160 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为case -- toast
2024-09-07 17:04:58,160 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为expect -- toast
2024-09-07 17:04:58,161 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为sql -- toast
2024-09-07 17:04:58,161 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为excel -- toast
2024-09-07 17:04:58,161 - read_user_ini.py[line:36] - INFO: 执行方法get_table_name为根据key获取table节点下key对应表名,形参key的传参为table_name -- toast
2024-09-07 17:04:58,561 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/auth,用例数据:{'username': 'admin', 'password': 'bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ='},期望数据:{'username': '超级管理员', 'account': 'admin', 'userId': '1', 'expiration': 86400, 'loginStatus': True},服务器返回数据:{"token":"eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsInRlbmFudElkIjoiLTEiLCJleHAiOjE3MjU3ODYxODcsImlhdCI6MTcyNTY5OTc4N30.1ld1-9ljHha6tuq1UCP_I6W_2pV5QA_6JeFKWTBpnDvWaaYXjxXuCLAfWz_Jjt_zZA6cAJqT2cQUQToyjBgFgg","username":"超级管理员","account":"admin","userId":"1","expiration":86400,"loginStatus":true,"userAttrs":{"tenantId":"-1"}} -- toast
2024-09-07 17:04:58,581 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/auth,用例数据:{'username': '', 'password': 'bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ='},期望数据:{'message': '账户错误或该租户未启用'},服务器返回数据:{"state":false,"message":"账户错误或该租户未启用","code":200,"logId":"1832343830037897216"} -- toast
2024-09-07 17:04:58,606 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/auth,用例数据:{'username': '#!$!@#!@#', 'password': 'bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ='},期望数据:{'message': '账户错误或该租户未启用'},服务器返回数据:{"state":false,"message":"账户错误或该租户未启用","code":200,"logId":"1832343830142754816"} -- toast
2024-09-07 17:04:58,640 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/auth,用例数据:{'username': 'adminadminadminadminadminadminadminadminadmin', 'password': 'bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ='},期望数据:{'message': '账户错误或该租户未启用'},服务器返回数据:{"state":false,"message":"账户错误或该租户未启用","code":200,"logId":"1832343830281166848"} -- toast
2024-09-07 17:04:58,665 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/auth,用例数据:{'username': 'a', 'password': 'bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ='},期望数据:{'message': '账户错误或该租户未启用'},服务器返回数据:{"state":false,"message":"账户错误或该租户未启用","code":200,"logId":"1832343830390218752"} -- toast
2024-09-07 17:04:58,690 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/auth,用例数据:{'username': 'adminxyz', 'password': 'bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ='},期望数据:{'message': '账户错误或该租户未启用'},服务器返回数据:{"state":false,"message":"账户错误或该租户未启用","code":200,"logId":"1832343830499270656"} -- toast
2024-09-07 17:04:58,719 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/auth,用例数据:{'username': 'admin', 'password': ''},期望数据:{'message': '账号或密码错误'},服务器返回数据:{"state":false,"message":"账号或密码错误","code":200,"logId":"1832343830620905472"} -- toast
2024-09-07 17:04:58,750 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/auth,用例数据:{'username': 'admin', 'password': '#!$!@#!@#'},期望数据:{'message': '账号或密码错误'},服务器返回数据:{"state":false,"message":"账号或密码错误","code":200,"logId":"1832343830746734592"} -- toast
2024-09-07 17:04:58,771 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/auth,用例数据:{'username': 'admin', 'password': 'bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jznbF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jznbF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jznbF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jznbF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn'},期望数据:{'message': '解密密码异常,请检查RSA公钥和私钥配置'},服务器返回数据:{"state":false,"message":"解密密码异常,请检查RSA公钥和私钥配置","code":200,"logId":"1832343830834814976"} -- toast
2024-09-07 17:04:58,788 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/auth,用例数据:{'username': 'admin', 'password': '123456'},期望数据:{'message': '解密密码异常,请检查RSA公钥和私钥配置'},服务器返回数据:{"state":false,"message":"解密密码异常,请检查RSA公钥和私钥配置","code":200,"logId":"1832343830910312448"} -- toast
2024-09-07 17:04:58,821 - test_bpm.py[line:49] - ERROR: 断言失败,接口url为:http://36.139.193.99:8088/auth,用例数据:{'username': 'admin', 'password': 'bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ'},期望数据:{'message': '账号或密码错误'},服务器返回数据:{"token":"eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsInRlbmFudElkIjoiLTEiLCJleHAiOjE3MjU3ODYxODcsImlhdCI6MTcyNTY5OTc4N30.1ld1-9ljHha6tuq1UCP_I6W_2pV5QA_6JeFKWTBpnDvWaaYXjxXuCLAfWz_Jjt_zZA6cAJqT2cQUQToyjBgFgg","username":"超级管理员","account":"admin","userId":"1","expiration":86400,"loginStatus":true,"userAttrs":{"tenantId":"-1"}} -- toast
2024-09-07 17:04:59,108 - test_bpm.py[line:49] - ERROR: 断言失败,接口url为:http://36.139.193.99:8088/refresh,用例数据:None,期望数据:{'message': '刷新token成功'},服务器返回数据:{"token":"eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsInRlbmFudElkIjoiLTEiLCJleHAiOjE3MjU3ODYxODcsImlhdCI6MTcyNTY5OTc4N30.1ld1-9ljHha6tuq1UCP_I6W_2pV5QA_6JeFKWTBpnDvWaaYXjxXuCLAfWz_Jjt_zZA6cAJqT2cQUQToyjBgFgg","username":"admin","account":"admin","userId":"","expiration":86400,"loginStatus":true} -- toast
2024-09-07 17:04:59,171 - test_bpm.py[line:49] - ERROR: 断言失败,接口url为:http://36.139.193.99:8088/api/demension/v1/dem/addDem,用例数据:{'code': 'requestsAddDem', 'description': 'requestsAddDem', 'isDefault': 1, 'name': 'requests添加的维度'},期望数据:{'message': '添加维度成功'},服务器返回数据:{"state":true,"message":"添加维度成功!","value":"","code":200} -- toast
2024-09-07 17:04:59,228 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/api/demension/v1/dem/deleteDemByIds,用例数据:{'ids': '1832343832432844800'},期望数据:{'message': '删除维度成功!'},服务器返回数据:{"state":true,"message":"删除维度成功!","value":"","code":200} -- toast
2024-09-07 17:07:11,257 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为case -- toast
2024-09-07 17:07:11,257 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为expect -- toast
2024-09-07 17:07:11,257 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为sql -- toast
2024-09-07 17:07:11,257 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为excel -- toast
2024-09-07 17:07:11,257 - read_user_ini.py[line:36] - INFO: 执行方法get_table_name为根据key获取table节点下key对应表名,形参key的传参为table_name -- toast
2024-09-07 17:07:11,389 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/auth,用例数据:{'username': 'admin', 'password': 'bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ='},期望数据:{'username': '超级管理员', 'account': 'admin', 'userId': '1', 'expiration': 86400, 'loginStatus': True},服务器返回数据:{"token":"eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsInRlbmFudElkIjoiLTEiLCJleHAiOjE3MjU3ODYzMTksImlhdCI6MTcyNTY5OTkxOX0.7K0D3R3FlYi7HD_cmL1CYf7AC9F3X-u_XxXh02xPAFvQtGFEWUzY_uTbkzm4U0Vw9WgCRYsJtwIG_NuWEQ1tJQ","username":"超级管理员","account":"admin","userId":"1","expiration":86400,"loginStatus":true,"userAttrs":{"tenantId":"-1"}} -- toast
2024-09-07 17:07:11,413 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/auth,用例数据:{'username': '', 'password': 'bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ='},期望数据:{'message': '账户错误或该租户未启用'},服务器返回数据:{"state":false,"message":"账户错误或该租户未启用","code":200,"logId":"1832344387175686144"} -- toast
2024-09-07 17:07:11,437 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/auth,用例数据:{'username': '#!$!@#!@#', 'password': 'bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ='},期望数据:{'message': '账户错误或该租户未启用'},服务器返回数据:{"state":false,"message":"账户错误或该租户未启用","code":200,"logId":"1832344387276349440"} -- toast
2024-09-07 17:07:11,462 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/auth,用例数据:{'username': 'adminadminadminadminadminadminadminadminadmin', 'password': 'bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ='},期望数据:{'message': '账户错误或该租户未启用'},服务器返回数据:{"state":false,"message":"账户错误或该租户未启用","code":200,"logId":"1832344387381207040"} -- toast
2024-09-07 17:07:11,490 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/auth,用例数据:{'username': 'a', 'password': 'bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ='},期望数据:{'message': '账户错误或该租户未启用'},服务器返回数据:{"state":false,"message":"账户错误或该租户未启用","code":200,"logId":"1832344387494453248"} -- toast
2024-09-07 17:07:11,519 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/auth,用例数据:{'username': 'adminxyz', 'password': 'bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ='},期望数据:{'message': '账户错误或该租户未启用'},服务器返回数据:{"state":false,"message":"账户错误或该租户未启用","code":200,"logId":"1832344387611893760"} -- toast
2024-09-07 17:07:11,551 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/auth,用例数据:{'username': 'admin', 'password': ''},期望数据:{'message': '账号或密码错误'},服务器返回数据:{"state":false,"message":"账号或密码错误","code":200,"logId":"1832344387750305792"} -- toast
2024-09-07 17:07:11,580 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/auth,用例数据:{'username': 'admin', 'password': '#!$!@#!@#'},期望数据:{'message': '账号或密码错误'},服务器返回数据:{"state":false,"message":"账号或密码错误","code":200,"logId":"1832344387871940608"} -- toast
2024-09-07 17:07:11,603 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/auth,用例数据:{'username': 'admin', 'password': 'bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jznbF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jznbF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jznbF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jznbF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn'},期望数据:{'message': '解密密码异常,请检查RSA公钥和私钥配置'},服务器返回数据:{"state":false,"message":"解密密码异常,请检查RSA公钥和私钥配置","code":200,"logId":"1832344387964215296"} -- toast
2024-09-07 17:07:11,623 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/auth,用例数据:{'username': 'admin', 'password': '123456'},期望数据:{'message': '解密密码异常,请检查RSA公钥和私钥配置'},服务器返回数据:{"state":false,"message":"解密密码异常,请检查RSA公钥和私钥配置","code":200,"logId":"1832344388052295680"} -- toast
2024-09-07 17:07:11,657 - test_bpm.py[line:49] - ERROR: 断言失败,接口url为:http://36.139.193.99:8088/auth,用例数据:{'username': 'admin', 'password': 'bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ'},期望数据:{'message': '账号或密码错误'},服务器返回数据:{"token":"eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsInRlbmFudElkIjoiLTEiLCJleHAiOjE3MjU3ODYzMjAsImlhdCI6MTcyNTY5OTkyMH0.H2p3QVeFtxXxsnHLK2Bovzkz567yiShCCEeVRxI8uoiIWz8g7Lc9qF-txDyHJmqp59AaEHmhZ1mrLWW3kkPA9w","username":"超级管理员","account":"admin","userId":"1","expiration":86400,"loginStatus":true,"userAttrs":{"tenantId":"-1"}} -- toast
2024-09-07 17:07:11,783 - test_bpm.py[line:49] - ERROR: 断言失败,接口url为:http://36.139.193.99:8088/refresh,用例数据:None,期望数据:{'message': '刷新token成功'},服务器返回数据:{"token":"eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsInRlbmFudElkIjoiLTEiLCJleHAiOjE3MjU3ODYzMjAsImlhdCI6MTcyNTY5OTkyMH0.H2p3QVeFtxXxsnHLK2Bovzkz567yiShCCEeVRxI8uoiIWz8g7Lc9qF-txDyHJmqp59AaEHmhZ1mrLWW3kkPA9w","username":"admin","account":"admin","userId":"","expiration":86400,"loginStatus":true} -- toast
2024-09-07 17:07:11,838 - test_bpm.py[line:49] - ERROR: 断言失败,接口url为:http://36.139.193.99:8088/api/demension/v1/dem/addDem,用例数据:{'code': 'requestsAddDem', 'description': 'requestsAddDem', 'isDefault': 1, 'name': 'requests添加的维度'},期望数据:{'message': '添加维度成功'},服务器返回数据:{"state":true,"message":"添加维度成功!","value":"","code":200} -- toast
2024-09-07 17:07:11,885 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/api/demension/v1/dem/deleteDemByIds,用例数据:{'ids': '1832344388912128000'},期望数据:{'message': '删除维度成功!'},服务器返回数据:{"state":true,"message":"删除维度成功!","value":"","code":200} -- toast
2024-09-07 17:08:17,399 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为case -- toast
2024-09-07 17:08:17,399 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为expect -- toast
2024-09-07 17:08:17,399 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为sql -- toast
2024-09-07 17:08:17,399 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为excel -- toast
2024-09-07 17:08:17,400 - read_user_ini.py[line:36] - INFO: 执行方法get_table_name为根据key获取table节点下key对应表名,形参key的传参为table_name -- toast
2024-09-07 17:08:17,588 - test_bpm.py[line:49] - ERROR: 断言失败,接口url为:http://36.139.193.99:8088/api/demension/v1/dem/addDem,用例数据:{'code': 'requestsAddDem', 'description': 'requestsAddDem', 'isDefault': 1, 'name': 'requests添加的维度'},期望数据:{'message': '添加维度成功'},服务器返回数据:{"state":true,"message":"添加维度成功!","value":"","code":200} -- toast
2024-09-07 17:08:17,735 - test_bpm.py[line:49] - ERROR: 断言失败,接口url为:http://36.139.193.99:8088/api/demension/v1/dem/updateDem,用例数据:{'code': 'requestsAddDem', 'description': 'requestsAddDem', 'isDefault': 0, 'name': 'requestsAddDem'},期望数据:{'message': '更新维度成功'},服务器返回数据:{"state":true,"message":"更新维度成功!","value":"","code":200} -- toast
2024-09-07 17:08:17,793 - test_bpm.py[line:49] - ERROR: 断言失败,接口url为:http://36.139.193.99:8088/api/org/v1/org/addOrg,用例数据:{'code': 'testAddOrg', 'demId': '1832344664687616000', 'exceedLimitNum': 0, 'grade': '', 'limitNum': 0, 'name': '测试添加的组织', 'nowNum': 0, 'orderNo': 0, 'parentId': '0'},期望数据:{'message': '添加组织成功'},服务器返回数据:{"state":true,"message":"添加组织成功!","value":"","code":200} -- toast
2024-09-07 17:08:17,840 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/api/org/v1/orgUsers/addUsersForOrg,用例数据:{'orgCode': 'testAddOrg', 'accounts': 'admin,guest'},期望数据:{'message': '加入成功'},服务器返回数据:{"state":true,"message":"加入成功","value":"","code":200} -- toast
2024-09-07 17:08:17,870 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/api/org/v1/orgParam/saveOrgParams,用例数据:{'query': {'orgCode': 'testAddOrg'}, 'body': [{'alias': 'hxxmts', 'value': '项目中没有关系户'}]},期望数据:{'message': '保存组织参数成功!'},服务器返回数据:{"state":true,"message":"保存组织参数成功!","value":"","code":200} -- toast
2024-09-07 17:08:17,900 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/api/org/v1/org/deleteOrg,用例数据:testAddOrg,期望数据:{'message': '删除组织成功!'},服务器返回数据:{"state":true,"message":"删除组织成功!","value":"","code":200} -- toast
2024-09-07 17:08:17,932 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/api/demension/v1/dem/deleteDemByIds,用例数据:{'ids': '1832344664687616000'},期望数据:{'message': '删除维度成功!'},服务器返回数据:{"state":true,"message":"删除维度成功!","value":"","code":200} -- toast
2024-09-09 10:55:01,728 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为case -- toast
2024-09-09 10:55:01,728 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为case -- toast
2024-09-09 10:55:01,729 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为expect -- toast
2024-09-09 10:55:01,729 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为expect -- toast
2024-09-09 10:55:01,729 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为sql -- toast
2024-09-09 10:55:01,729 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为sql -- toast
2024-09-09 10:55:01,729 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为excel -- toast
2024-09-09 10:55:01,729 - read_user_ini.py[line:26] - INFO: 执行方法get_file_path为根据key获取file节点下key对应文件的路径,形参key的传参为excel -- toast
2024-09-09 10:55:01,729 - read_user_ini.py[line:36] - INFO: 执行方法get_table_name为根据key获取table节点下key对应表名,形参key的传参为table_name -- toast
2024-09-09 10:55:01,729 - read_user_ini.py[line:36] - INFO: 执行方法get_table_name为根据key获取table节点下key对应表名,形参key的传参为table_name -- toast
2024-09-09 10:55:02,516 - test_bpm.py[line:49] - ERROR: 断言失败,接口url为:http://36.139.193.99:8088/api/demension/v1/dem/addDem,用例数据:{'code': 'requestsAddDem', 'description': 'requestsAddDem', 'isDefault': 1, 'name': 'requests添加的维度'},期望数据:{'message': '添加维度成功'},服务器返回数据:{"state":true,"message":"添加维度成功!","value":"","code":200} -- toast
2024-09-09 10:55:02,516 - test_bpm.py[line:49] - ERROR: 断言失败,接口url为:http://36.139.193.99:8088/api/demension/v1/dem/addDem,用例数据:{'code': 'requestsAddDem', 'description': 'requestsAddDem', 'isDefault': 1, 'name': 'requests添加的维度'},期望数据:{'message': '添加维度成功'},服务器返回数据:{"state":true,"message":"添加维度成功!","value":"","code":200} -- toast
2024-09-09 10:55:02,831 - test_bpm.py[line:49] - ERROR: 断言失败,接口url为:http://36.139.193.99:8088/api/demension/v1/dem/updateDem,用例数据:{'code': 'requestsAddDem', 'description': 'requestsAddDem', 'isDefault': 0, 'name': 'requestsAddDem'},期望数据:{'message': '更新维度成功'},服务器返回数据:{"state":true,"message":"更新维度成功!","value":"","code":200} -- toast
2024-09-09 10:55:02,831 - test_bpm.py[line:49] - ERROR: 断言失败,接口url为:http://36.139.193.99:8088/api/demension/v1/dem/updateDem,用例数据:{'code': 'requestsAddDem', 'description': 'requestsAddDem', 'isDefault': 0, 'name': 'requestsAddDem'},期望数据:{'message': '更新维度成功'},服务器返回数据:{"state":true,"message":"更新维度成功!","value":"","code":200} -- toast
2024-09-09 10:55:02,878 - test_bpm.py[line:49] - ERROR: 断言失败,接口url为:http://36.139.193.99:8088/api/org/v1/org/addOrg,用例数据:{'code': 'testAddOrg', 'demId': '1832975501154164736', 'exceedLimitNum': 0, 'grade': '', 'limitNum': 0, 'name': '测试添加的组织', 'nowNum': 0, 'orderNo': 0, 'parentId': '0'},期望数据:{'message': '添加组织成功'},服务器返回数据:{"state":true,"message":"添加组织成功!","value":"","code":200} -- toast
2024-09-09 10:55:02,878 - test_bpm.py[line:49] - ERROR: 断言失败,接口url为:http://36.139.193.99:8088/api/org/v1/org/addOrg,用例数据:{'code': 'testAddOrg', 'demId': '1832975501154164736', 'exceedLimitNum': 0, 'grade': '', 'limitNum': 0, 'name': '测试添加的组织', 'nowNum': 0, 'orderNo': 0, 'parentId': '0'},期望数据:{'message': '添加组织成功'},服务器返回数据:{"state":true,"message":"添加组织成功!","value":"","code":200} -- toast
2024-09-09 10:55:02,923 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/api/org/v1/orgUsers/addUsersForOrg,用例数据:{'orgCode': 'testAddOrg', 'accounts': 'admin,guest'},期望数据:{'message': '加入成功'},服务器返回数据:{"state":true,"message":"加入成功","value":"","code":200} -- toast
2024-09-09 10:55:02,923 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/api/org/v1/orgUsers/addUsersForOrg,用例数据:{'orgCode': 'testAddOrg', 'accounts': 'admin,guest'},期望数据:{'message': '加入成功'},服务器返回数据:{"state":true,"message":"加入成功","value":"","code":200} -- toast
2024-09-09 10:55:02,946 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/api/org/v1/orgParam/saveOrgParams,用例数据:{'query': {'orgCode': 'testAddOrg'}, 'body': [{'alias': 'hxxmts', 'value': '项目中没有关系户'}]},期望数据:{'message': '保存组织参数成功!'},服务器返回数据:{"state":true,"message":"保存组织参数成功!","value":"","code":200} -- toast
2024-09-09 10:55:02,946 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/api/org/v1/orgParam/saveOrgParams,用例数据:{'query': {'orgCode': 'testAddOrg'}, 'body': [{'alias': 'hxxmts', 'value': '项目中没有关系户'}]},期望数据:{'message': '保存组织参数成功!'},服务器返回数据:{"state":true,"message":"保存组织参数成功!","value":"","code":200} -- toast
2024-09-09 10:55:02,980 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/api/org/v1/org/deleteOrg,用例数据:testAddOrg,期望数据:{'message': '删除组织成功!'},服务器返回数据:{"state":true,"message":"删除组织成功!","value":"","code":200} -- toast
2024-09-09 10:55:02,980 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/api/org/v1/org/deleteOrg,用例数据:testAddOrg,期望数据:{'message': '删除组织成功!'},服务器返回数据:{"state":true,"message":"删除组织成功!","value":"","code":200} -- toast
2024-09-09 10:55:03,012 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/api/demension/v1/dem/deleteDemByIds,用例数据:{'ids': '1832975501154164736'},期望数据:{'message': '删除维度成功!'},服务器返回数据:{"state":true,"message":"删除维度成功!","value":"","code":200} -- toast
2024-09-09 10:55:03,012 - test_bpm.py[line:52] - INFO: 断言成功,接口url为:http://36.139.193.99:8088/api/demension/v1/dem/deleteDemByIds,用例数据:{'ids': '1832975501154164736'},期望数据:{'message': '删除维度成功!'},服务器返回数据:{"state":true,"message":"删除维度成功!","value":"","code":200} -- toast
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: pythonProject
# FileName: __init__.py
# Author: toast
# Datetime: 2024/9/7 下午2:05
# Description:
#
# ---------------------------------------------------------------------------
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: pythonProject
# FileName: request_method.py
# Author: toast
# Datetime: 2024/9/7 下午2:05
# Description:
#
# ---------------------------------------------------------------------------
import requests
from apiAutoTest_v3.common.read_project_ini import ReadProjectIni
class RequestMethod:
def __init__(self):
login_url = ReadProjectIni().get_host("bpm_host")+"/auth"
login_data = {"username": "admin", "password": "bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQ"
"qmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerV"
"lYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ="}
self.bpm_session= requests.sessions.Session()
res = self.bpm_session.post(url=login_url, json=login_data)
token = res.json().get("token")
self.bpm_session.headers["Authorization"] = f"Bearer {token}"
def request_all(self,req_method,req_url,req_mime,case_data):
if req_mime == "application/x-www-form-urlencoded" or req_mime == "form":
return self.bpm_session.request(method=req_method,url=req_url,data=case_data)
elif req_mime == "application/json" or req_mime == "json":
return self.bpm_session.request(method=req_method,url=req_url,json=case_data)
elif req_mime == "multipart/form_data" or req_mime == "form-data":
return self.bpm_session.request(method=req_method,url=req_url,files=case_data)
elif req_mime == "query" or req_mime == "params":
return self.bpm_session.request(method=req_method,url=req_url,params=case_data)
elif req_mime is None:
return self.bpm_session.request(method=req_method,url=req_url)
elif req_mime == "query|json" or req_mime == "json|params":
return self.bpm_session.request(method=req_method,url=req_url,params=case_data["query"],json=case_data["body"])
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: pythonProject
# FileName: __init__.py
# Author: toast
# Datetime: 2024/9/7 下午2:21
# Description:
#
# ---------------------------------------------------------------------------
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: pythonProject
# FileName: __init__.py
# Author: toast
# Datetime: 2024/9/7 下午3:56
# Description:
#
# ---------------------------------------------------------------------------
namespace = 'bread'
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: pythonProject
# FileName: conftest.py
# Author: toast
# Datetime: 2024/9/7 下午2:23
# Description:
#
# ---------------------------------------------------------------------------
import pytest
from apiAutoTest_v3.common.db import DB
from apiAutoTest_v3.request_method.request_method import RequestMethod
@pytest.fixture(scope="session")
def fix_db():
db = DB()
yield db
db.close()
@pytest.fixture(scope="session")
def fix_req():
req = RequestMethod()
yield req
\ No newline at end of file
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: pythonProject
# FileName: test_bpm.py
# Author: toast
# Datetime: 2024/9/7 下午2:26
# Description:
#
# ---------------------------------------------------------------------------
import allure
import pytest
from apiAutoTest_v3 import log
from apiAutoTest_v3.common.read_excel import ReadExcel
from apiAutoTest_v3.test_case.bread import namespace
excel = ReadExcel(namespace)
class TestBPM:
@allure.epic("BPM项目-bread")
@pytest.mark.parametrize("module_name, api_name, level, title, url, method, mime, case_data, expect_data, sql_type, sql_data, update_key",excel.get_data())
def test_bpm(self,fix_db,fix_req,module_name, api_name, level, title, url, method, mime, case_data, expect_data, sql_type, sql_data, update_key):
allure.dynamic.feature(module_name)
allure.dynamic.story(api_name)
allure.dynamic.title(title)
allure.dynamic.severity(level)
if sql_type == "delete":
fix_db.delete(sql_data["delete"])
elif sql_type == "select":
select_result = fix_db.select(sql_data["select"])
case_data[update_key] = select_result
elif sql_type == "select|delete" or sql_type == "delete|select":
fix_db.delete(sql_data["delete"])
select_result = fix_db.select(sql_data["select"])
case_data[update_key] = select_result
res = fix_req.request_all(req_method=method, req_url=url, req_mime=mime, case_data=case_data)
try:
for key in expect_data.keys():
assert expect_data[key] == res.json().get(key)
except AssertionError:
log.error(f"断言失败,接口url为:{url},用例数据:{case_data},期望数据:{expect_data},服务器返回数据:{res.text}")
raise AssertionError("断言失败")
else:
log.info(f"断言成功,接口url为:{url},用例数据:{case_data},期望数据:{expect_data},服务器返回数据:{res.text}")
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: pythonProject
# FileName: __init__.py
# Author: toast
# Datetime: 2024/9/7 下午2:21
# Description:
#
# ---------------------------------------------------------------------------
namespace = "toast"
\ No newline at end of file
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: pythonProject
# FileName: conftest.py
# Author: toast
# Datetime: 2024/9/7 下午2:23
# Description:
#
# ---------------------------------------------------------------------------
import pytest
from apiAutoTest_v3.common.db import DB
from apiAutoTest_v3.request_method.request_method import RequestMethod
@pytest.fixture(scope="session")
def fix_db():
db = DB()
yield db
db.close()
@pytest.fixture(scope="session")
def fix_req():
req = RequestMethod()
yield req
\ No newline at end of file
[pytest]
log_file_level = error
log_file_format = %(levelname)s--%(asctime)s--%(message)s
log_file_data_format = %Y-%m-%d %H:%M:%S
\ No newline at end of file
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: pythonProject
# FileName: test_bpm.py
# Author: toast
# Datetime: 2024/9/7 下午2:26
# Description:
#
# ---------------------------------------------------------------------------
import allure
import pytest
from apiAutoTest_v3 import log
from apiAutoTest_v3.common.read_excel import ReadExcel
from apiAutoTest_v3.test_case.toast import namespace
excel = ReadExcel(namespace)
class TestBPM:
@allure.epic("BPM项目-toast")
@pytest.mark.parametrize("module_name, api_name, level, title, url, method, mime, case_data, expect_data, sql_type, sql_data, update_key",excel.get_data())
def test_bpm(self,fix_db,fix_req,module_name, api_name, level, title, url, method, mime, case_data, expect_data, sql_type, sql_data, update_key):
allure.dynamic.feature(module_name)
allure.dynamic.story(api_name)
allure.dynamic.title(title)
allure.dynamic.severity(level)
if sql_type == "delete":
fix_db.delete(sql_data)
elif sql_type == "select":
select_result = fix_db.select(sql_data)
case_data[update_key] = select_result
elif sql_type == "select|delete" or sql_type == "delete|select":
fix_db.delete(sql_data)
select_result = fix_db.select(sql_data)
case_data[update_key] = select_result
res = fix_req.request_all(req_method=method, req_url=url, req_mime=mime, case_data=case_data)
try:
for key in expect_data.keys():
assert expect_data[key] == res.json().get(key)
except AssertionError:
log.error(f"断言失败,接口url为:{url},用例数据:{case_data},期望数据:{expect_data},服务器返回数据:{res.text}")
raise AssertionError("断言失败")
else:
log.info(f"断言成功,接口url为:{url},用例数据:{case_data},期望数据:{expect_data},服务器返回数据:{res.text}")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment