Commit 4fcd2575 by cxx

v_1.0

parent be6fae14
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: test62
# FileName: __init__.py
# Author: lao_zhao
# Datetime: 2024/9/4 14:01
# Description:
#
# ---------------------------------------------------------------------------
import logging
import os
import time
def log(name="张三"):
# 创建Logger对象
logger = logging.getLogger(name)
# 设置日志的级别
logger.level = logging.INFO
# 2024-09-04-14-09-10.log
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对象添加文件
logger.addHandler(handle)
# 将Logger对象返回
return logger
# 先执行函数,获取函数的返回值,以后之间使用函数的返回值写入日志
log = log()
\ No newline at end of file
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: test62
# FileName: __init__.py
# Author: lao_zhao
# Datetime: 2024/9/4 14:01
# Description:
#
# ---------------------------------------------------------------------------
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: test62
# FileName: read_ini.py
# Author: lao_zhao
# Datetime: 2024/9/4 14:17
# Description:
#
# ---------------------------------------------------------------------------
import configparser
import os
from apiAutoTest_v3 import log
class ReadIni:
def __init__(self):
"""获取ini文件的路径,并读取ini"""
self.data_config = os.path.join(os.path.dirname(os.path.dirname(__file__)), "data_config")
ini_path = os.path.join(self.data_config, "basic_config.ini")
self.conf = configparser.ConfigParser()
self.conf.read(ini_path, encoding="utf-8")
def get_host(self, key):
"""根据key获取host节点下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):
"""根据key获取sql节点下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 = ReadIni()
\ No newline at end of file
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: test62
# FileName: db.py
# Author: lao_zhao
# Datetime: 2024/9/4 14:35
# Description:
#
# ---------------------------------------------------------------------------
import pymysql
from apiAutoTest_v3 import log
from apiAutoTest_v3.common.basic_read_ini import ReadIni
class DB:
def __init__(self):
"""链接数据库,获取链接对象和游标对象"""
ini = ReadIni()
self.conn = pymysql.connect(
host=ini.get_sql_connect_msg("host"),
port=int(ini.get_sql_connect_msg("port")),
user=ini.get_sql_connect_msg("user"),
password=ini.get_sql_connect_msg("password"),
database=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):
"""执行查询的sql语句,并返回查询的结果"""
if isinstance(sql, str):
if sql.strip().lower().startswith("select"):
try:
self.cursor.execute(sql)
except Exception as e:
log.error(f"执行select方法时,产生错误,错误为:{e},sql语句为:{sql}")
raise 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}")
raise e
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):
"""执行删除的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语句错误")
\ No newline at end of file
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: test62
# FileName: read_excel.py
# Author: lao_zhao
# Datetime: 2024/9/4 14:53
# Description:
#
# ---------------------------------------------------------------------------
import openpyxl
from apiAutoTest_v3 import log
from apiAutoTest_v3.common.read_json import read_json
from apiAutoTest_v3.common.user_read_ini import ReadIni
from apiAutoTest_v3.common.basic_read_ini import ReadIni as BasicIni
from apiAutoTest_v3.data_config.settings import *
class ReadExcel:
def __init__(self, username):
"""获取所有json文件的路径,并读取json文件,再获取excel文件的路径,加载excel的工作簿,并获取工作表的名称,再获取工作表"""
self.ini = ReadIni(username)
case_data_path = self.ini.get_file_path(FILE_CASE)
expect_data_path = self.ini.get_file_path(FILE_EXPECT)
sql_data_path = self.ini.get_file_path(FILE_SQL)
excel_path = self.ini.get_file_path(FILE_EXCEL)
table_name = self.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 module_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):
"""根据行号,获取用例的url"""
path = self.__get_cell_value(URL, row)
if path:
return BasicIni().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.module_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.module_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语句"""
sql_data_key = self.__get_cell_value(SQL_DATA, row)
if sql_data_key:
module_name = self.module_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语句的类型"""
value = self.__get_cell_value(SQL_TYPE, row)
if value:
return value.lower()
def update_key(self, row):
"""根号行号,获取更新的key"""
return self.__get_cell_value(UPDATE_KEY, row)
def get_data(self):
"""获取所有的测试数据,并存放在一个二维列表中"""
list_data = []
for row in range(2, self.ws.max_row+1):
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_key = self.update_key(row)
if url is not None and method is not None and expect_data is not None:
list_data.append([url, method, mime, case_data, expect_data, sql_type, sql_data, update_key])
else:
return list_data
if __name__ == '__main__':
excel = ReadExcel("lao_zhang")
print(excel.get_data())
\ No newline at end of file
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: test62
# FileName: read_json.py
# Author: lao_zhao
# Datetime: 2024/9/4 14:31
# Description:
#
# ---------------------------------------------------------------------------
import json
from apiAutoTest_v3 import log
def read_json(file_path):
"""读取json文件,将json文件的数据序列化为python对象再返回"""
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: test62
# FileName: read_ini.py
# Author: lao_zhao
# Datetime: 2024/9/4 14:17
# Description:
#
# ---------------------------------------------------------------------------
import configparser
import os
from apiAutoTest_v3 import log
class ReadIni:
def __init__(self, username):
"""获取ini文件的路径,并读取ini"""
data_config = os.path.join(os.path.dirname(os.path.dirname(__file__)), "data_config")
self.user_dir = os.path.join(data_config, username)
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):
"""根据key获取file节点下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):
"""根据key获取table节点下key对应的工作表名"""
try:
return self.conf.get("table", key)
except Exception as e:
log.error(f"方法get_table_name执行失败,形参key传参为:{key},错误为:{e}")
raise e
if __name__ == '__main__':
ini = ReadIni()
print(ini.get_file_path("excel"))
\ No newline at end of file
[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
{
"认证接口":{
"登录系统":{
"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"
}
}
}
[file]
# 配置数据配置层中文件的名称
excel=apiAutoTest.xlsx
case=case_data.json
expect=expect_data.json
sql=sql_data.json
[table]
# 配置工作表名称
table_name=BPM
{
"认证接口":{
"登录系统":{
"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\";"
}
}
}
}
{
"认证接口":{
"登录系统":{
"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"
}
}
}
[file]
# 配置数据配置层中文件的名称
excel=apiAutoTest.xlsx
case=case_data.json
expect=expect_data.json
sql=sql_data.json
[table]
# 配置工作表名称
table_name=BPM
{
"认证接口":{
"登录系统":{
"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\";"
}
}
}
}
{
"认证接口":{
"登录系统":{
"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"
}
}
}
[file]
# 配置数据配置层中文件的名称
excel=apiAutoTest.xlsx
case=case_data.json
expect=expect_data.json
sql=sql_data.json
[table]
# 配置工作表名称
table_name=BPM
{
"认证接口":{
"登录系统":{
"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\";"
}
}
}
}
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: test62
# FileName: settings.py
# Author: lao_zhao
# Datetime: 2024/9/4 16:03
# 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
{"uuid": "ac50e2b9-7347-4cfb-b707-0205d1da0654", "befores": [{"name": "case_data", "status": "passed", "start": 1725509874243, "stop": 1725509874243}], "start": 1725509874243, "stop": 1725509874282}
\ No newline at end of file
{"uuid": "5d258f92-e8a5-4d67-afc6-0a7d284f0f90", "befores": [{"name": "update_key", "status": "passed", "start": 1725509875130, "stop": 1725509875130}], "start": 1725509875130, "stop": 1725509875169}
\ No newline at end of file
{"uuid": "88f97c78-33d1-4015-aa93-4b34a9f2321d", "befores": [{"name": "url", "status": "passed", "start": 1725509873919, "stop": 1725509873919}], "start": 1725509873919, "stop": 1725509873971}
\ No newline at end of file
{"uuid": "d53ae35e-1dab-4f1e-a823-46c6fad5a354", "befores": [{"name": "mime", "status": "passed", "start": 1725509874705, "stop": 1725509874705}], "start": 1725509874705, "stop": 1725509874766}
\ No newline at end of file
ERROR  张三:test_bpm.py:54 断言失败,接口url为:http://36.139.193.99:8088/auth, 用例数据:{'username': '', 'password': 'bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ='}, 期望数据:{'message': '账号或密码错误'}, 服务器返回数据:{"state":false,"message":"账户错误或该租户未启用","code":200,"logId":"1831546818736529408"}
\ No newline at end of file
{"uuid": "013247b8-59ed-4f6c-88fa-716e21d966d1", "befores": [{"name": "update_key", "status": "passed", "start": 1725509875221, "stop": 1725509875221}], "start": 1725509875221, "stop": 1725509875251}
\ No newline at end of file
{"uuid": "684b98a1-bd71-42ec-aa88-7181b04d3be6", "befores": [{"name": "sql_data", "status": "passed", "start": 1725509874936, "stop": 1725509874936}], "start": 1725509874936, "stop": 1725509874972}
\ No newline at end of file
{"uuid": "01098f29-7317-472d-9cc7-652736ba234a", "befores": [{"name": "update_key", "status": "passed", "start": 1725509874199, "stop": 1725509874199}], "start": 1725509874199, "stop": 1725509874231}
\ No newline at end of file
{"uuid": "c5084175-c242-4d39-8a26-40da1707522f", "befores": [{"name": "expect_data", "status": "passed", "start": 1725509873792, "stop": 1725509873793}], "start": 1725509873792, "stop": 1725509873831}
\ No newline at end of file
{"uuid": "7bb7e85a-5058-49e2-ba42-875d65f2d8cf", "befores": [{"name": "sql_data", "status": "passed", "start": 1725509874609, "stop": 1725509874609}], "start": 1725509874609, "stop": 1725509874641}
\ No newline at end of file
{"uuid": "8aaeb824-ae32-4d67-a49c-08cae882d2ea", "befores": [{"name": "mime", "status": "passed", "start": 1725509873975, "stop": 1725509873975}], "start": 1725509873975, "stop": 1725509874025}
\ No newline at end of file
{"name": "test_bpm[http://36.139.193.99:8088/api/org/v1/org/addOrg-POST-json-case_data2-expect_data2-delete|select-sql_data2-demId]", "status": "failed", "statusDetails": {"message": "AssertionError: 断言失败", "trace": "self = <apiAutoTest_v3.test_case.test_demo.test_bpm.TestBPM object at 0x000002087641A720>, fix_db = <apiAutoTest_v3.common.db.DB object at 0x00000208763FD310>\nfix_req = <apiAutoTest_v3.request_method.request_method.RequestMethod object at 0x0000020876411130>, url = 'http://36.139.193.99:8088/api/org/v1/org/addOrg'\nmethod = 'POST', mime = 'json', case_data = {'code': 'testAddOrg', 'demId': '1831546815687270400', 'exceedLimitNum': 0, 'grade': '', ...}\nexpect_data = {'message': '添加组织成功'}, sql_type = 'delete|select'\nsql_data = {'delete': 'delete from uc_org where CODE_=\"testAddOrg\";', 'select': 'select ID_ from uc_demension where CODE_=\"requestsAddDem\"; '}\nupdate_key = 'demId'\n\n @pytest.mark.parametrize(\"url, method, mime, case_data, expect_data, sql_type, sql_data, update_key\", excel.get_data())\n def test_bpm(self, fix_db, fix_req, url, method, mime, case_data, expect_data, sql_type, sql_data, update_key):\n \n # 判断sql语句的类型是否为delete\n if sql_type == \"delete\":\n # 使用DB类对象调用delete方法执行删除的sql语句,DB类对象===fix_db自定义固件\n fix_db.delete(sql_data['delete'])\n \n # 判断sql语句类型是否为select\n elif sql_type == \"select\":\n # 使用DB类对象调用select方法执行查询的sql语句, 并获取查询结果,DB类对象===fix_db自定义固件\n select_result = fix_db.select(sql_data['select'])\n # 将查询结果更新到用例数据中\n case_data[update_key] = select_result\n \n # 判断sql语句的类型是否为select|delete 或者为 delete|select\n elif sql_type == \"select|delete\" or sql_type == \"delete|select\":\n # 使用DB类对象调用delete方法执行删除的sql语句,DB类对象===fix_db自定义固件\n fix_db.delete(sql_data['delete'])\n \n # 使用DB类对象调用select方法执行查询的sql语句, 并获取查询结果,DB类对象===fix_db自定义固件\n select_result = fix_db.select(sql_data['select'])\n # 将查询结果更新到用例数据中\n case_data[update_key] = select_result\n \n # 使用RequestMethod类对象发送请求\n res = fix_req.request_all(req_method=method, req_url=url, req_mime=mime, case_data=case_data)\n \n # 断言\n try:\n for key in expect_data.keys():\n> assert expect_data[key] == res.json().get(key)\nE AssertionError: assert '添加组织成功' == '添加组织成功!'\nE \nE - 添加组织成功!\nE ? -\nE + 添加组织成功\n\ntest_case\\test_demo\\test_bpm.py:52: AssertionError\n\nDuring handling of the above exception, another exception occurred:\n\nself = <apiAutoTest_v3.test_case.test_demo.test_bpm.TestBPM object at 0x000002087641A720>, fix_db = <apiAutoTest_v3.common.db.DB object at 0x00000208763FD310>\nfix_req = <apiAutoTest_v3.request_method.request_method.RequestMethod object at 0x0000020876411130>, url = 'http://36.139.193.99:8088/api/org/v1/org/addOrg'\nmethod = 'POST', mime = 'json', case_data = {'code': 'testAddOrg', 'demId': '1831546815687270400', 'exceedLimitNum': 0, 'grade': '', ...}\nexpect_data = {'message': '添加组织成功'}, sql_type = 'delete|select'\nsql_data = {'delete': 'delete from uc_org where CODE_=\"testAddOrg\";', 'select': 'select ID_ from uc_demension where CODE_=\"requestsAddDem\"; '}\nupdate_key = 'demId'\n\n @pytest.mark.parametrize(\"url, method, mime, case_data, expect_data, sql_type, sql_data, update_key\", excel.get_data())\n def test_bpm(self, fix_db, fix_req, url, method, mime, case_data, expect_data, sql_type, sql_data, update_key):\n \n # 判断sql语句的类型是否为delete\n if sql_type == \"delete\":\n # 使用DB类对象调用delete方法执行删除的sql语句,DB类对象===fix_db自定义固件\n fix_db.delete(sql_data['delete'])\n \n # 判断sql语句类型是否为select\n elif sql_type == \"select\":\n # 使用DB类对象调用select方法执行查询的sql语句, 并获取查询结果,DB类对象===fix_db自定义固件\n select_result = fix_db.select(sql_data['select'])\n # 将查询结果更新到用例数据中\n case_data[update_key] = select_result\n \n # 判断sql语句的类型是否为select|delete 或者为 delete|select\n elif sql_type == \"select|delete\" or sql_type == \"delete|select\":\n # 使用DB类对象调用delete方法执行删除的sql语句,DB类对象===fix_db自定义固件\n fix_db.delete(sql_data['delete'])\n \n # 使用DB类对象调用select方法执行查询的sql语句, 并获取查询结果,DB类对象===fix_db自定义固件\n select_result = fix_db.select(sql_data['select'])\n # 将查询结果更新到用例数据中\n case_data[update_key] = select_result\n \n # 使用RequestMethod类对象发送请求\n res = fix_req.request_all(req_method=method, req_url=url, req_mime=mime, case_data=case_data)\n \n # 断言\n try:\n for key in expect_data.keys():\n assert expect_data[key] == res.json().get(key)\n except AssertionError:\n log.error(f\"断言失败,接口url为:{url}, 用例数据:{case_data}, 期望数据:{expect_data}, 服务器返回数据:{res.text}\")\n> raise AssertionError(\"断言失败\")\nE AssertionError: 断言失败\n\ntest_case\\test_demo\\test_bpm.py:55: AssertionError"}, "attachments": [{"name": "log", "source": "e99f3d6b-2c99-40eb-ab52-cc644da410a4-attachment.txt", "type": "text/plain"}], "parameters": [{"name": "url", "value": "'http://36.139.193.99:8088/api/org/v1/org/addOrg'"}, {"name": "method", "value": "'POST'"}, {"name": "mime", "value": "'json'"}, {"name": "case_data", "value": "{'code': 'testAddOrg', 'demId': '需要更新', 'exceedLimitNum': 0, 'grade': '', 'limitNum': 0, 'name': '测试添加的组织', 'nowNum': 0, 'orderNo': 0, 'parentId': '0'}"}, {"name": "expect_data", "value": "{'message': '添加组织成功'}"}, {"name": "sql_type", "value": "'delete|select'"}, {"name": "sql_data", "value": "{'select': 'select ID_ from uc_demension where CODE_=\"requestsAddDem\"; ', 'delete': 'delete from uc_org where CODE_=\"testAddOrg\";'}"}, {"name": "update_key", "value": "'demId'"}], "start": 1725509873838, "stop": 1725509873888, "uuid": "7950588d-e0b7-41c6-9663-ddc40885337f", "historyId": "8601057ef64fcd13fa3bee37103323a1", "testCaseId": "2de48645219de93dc51c83a53a42f952", "fullName": "test_case.test_demo.test_bpm.TestBPM#test_bpm", "labels": [{"name": "parentSuite", "value": "test_case.test_demo"}, {"name": "suite", "value": "test_bpm"}, {"name": "subSuite", "value": "TestBPM"}, {"name": "host", "value": "DESKTOP-4FFIKGU"}, {"name": "thread", "value": "17444-MainThread"}, {"name": "framework", "value": "pytest"}, {"name": "language", "value": "cpython3"}, {"name": "package", "value": "test_case.test_demo.test_bpm"}]}
\ No newline at end of file
{"uuid": "e0295b30-e3eb-49a1-94f1-8cdb60932ad9", "befores": [{"name": "sql_type", "status": "passed", "start": 1725509874399, "stop": 1725509874399}], "start": 1725509874399, "stop": 1725509874451}
\ No newline at end of file
{"name": "test_bpm[http://36.139.193.99:8088/api/demension/v1/dem/deleteDemByIds-delete-query-case_data6-expect_data6-select-sql_data6-ids]", "status": "failed", "statusDetails": {"message": "AssertionError: 断言失败", "trace": "self = <apiAutoTest_v3.test_case.test_demo.test_bpm.TestBPM object at 0x0000020876313BF0>, fix_db = <apiAutoTest_v3.common.db.DB object at 0x00000208763FD310>\nfix_req = <apiAutoTest_v3.request_method.request_method.RequestMethod object at 0x0000020876411130>\nurl = 'http://36.139.193.99:8088/api/demension/v1/dem/deleteDemByIds', method = 'delete', mime = 'query', case_data = {'ids': '1831546815687270400'}\nexpect_data = {'message': '删除维度成功!'}, sql_type = 'select', sql_data = {'select': 'select ID_ from uc_demension where CODE_=\"requestsAddDem\";'}\nupdate_key = 'ids'\n\n @pytest.mark.parametrize(\"url, method, mime, case_data, expect_data, sql_type, sql_data, update_key\", excel.get_data())\n def test_bpm(self, fix_db, fix_req, url, method, mime, case_data, expect_data, sql_type, sql_data, update_key):\n \n # 判断sql语句的类型是否为delete\n if sql_type == \"delete\":\n # 使用DB类对象调用delete方法执行删除的sql语句,DB类对象===fix_db自定义固件\n fix_db.delete(sql_data['delete'])\n \n # 判断sql语句类型是否为select\n elif sql_type == \"select\":\n # 使用DB类对象调用select方法执行查询的sql语句, 并获取查询结果,DB类对象===fix_db自定义固件\n select_result = fix_db.select(sql_data['select'])\n # 将查询结果更新到用例数据中\n case_data[update_key] = select_result\n \n # 判断sql语句的类型是否为select|delete 或者为 delete|select\n elif sql_type == \"select|delete\" or sql_type == \"delete|select\":\n # 使用DB类对象调用delete方法执行删除的sql语句,DB类对象===fix_db自定义固件\n fix_db.delete(sql_data['delete'])\n \n # 使用DB类对象调用select方法执行查询的sql语句, 并获取查询结果,DB类对象===fix_db自定义固件\n select_result = fix_db.select(sql_data['select'])\n # 将查询结果更新到用例数据中\n case_data[update_key] = select_result\n \n # 使用RequestMethod类对象发送请求\n res = fix_req.request_all(req_method=method, req_url=url, req_mime=mime, case_data=case_data)\n \n # 断言\n try:\n for key in expect_data.keys():\n> assert expect_data[key] == res.json().get(key)\nE AssertionError: assert '删除维度成功!' == '【requestsAdd...度下存在组织,不允许删除 '\nE \nE - 【requestsAddDem(requestsAddDem)】的维度下存在组织,不允许删除 \nE + 删除维度成功!\n\ntest_case\\test_demo\\test_bpm.py:52: AssertionError\n\nDuring handling of the above exception, another exception occurred:\n\nself = <apiAutoTest_v3.test_case.test_demo.test_bpm.TestBPM object at 0x0000020876313BF0>, fix_db = <apiAutoTest_v3.common.db.DB object at 0x00000208763FD310>\nfix_req = <apiAutoTest_v3.request_method.request_method.RequestMethod object at 0x0000020876411130>\nurl = 'http://36.139.193.99:8088/api/demension/v1/dem/deleteDemByIds', method = 'delete', mime = 'query', case_data = {'ids': '1831546815687270400'}\nexpect_data = {'message': '删除维度成功!'}, sql_type = 'select', sql_data = {'select': 'select ID_ from uc_demension where CODE_=\"requestsAddDem\";'}\nupdate_key = 'ids'\n\n @pytest.mark.parametrize(\"url, method, mime, case_data, expect_data, sql_type, sql_data, update_key\", excel.get_data())\n def test_bpm(self, fix_db, fix_req, url, method, mime, case_data, expect_data, sql_type, sql_data, update_key):\n \n # 判断sql语句的类型是否为delete\n if sql_type == \"delete\":\n # 使用DB类对象调用delete方法执行删除的sql语句,DB类对象===fix_db自定义固件\n fix_db.delete(sql_data['delete'])\n \n # 判断sql语句类型是否为select\n elif sql_type == \"select\":\n # 使用DB类对象调用select方法执行查询的sql语句, 并获取查询结果,DB类对象===fix_db自定义固件\n select_result = fix_db.select(sql_data['select'])\n # 将查询结果更新到用例数据中\n case_data[update_key] = select_result\n \n # 判断sql语句的类型是否为select|delete 或者为 delete|select\n elif sql_type == \"select|delete\" or sql_type == \"delete|select\":\n # 使用DB类对象调用delete方法执行删除的sql语句,DB类对象===fix_db自定义固件\n fix_db.delete(sql_data['delete'])\n \n # 使用DB类对象调用select方法执行查询的sql语句, 并获取查询结果,DB类对象===fix_db自定义固件\n select_result = fix_db.select(sql_data['select'])\n # 将查询结果更新到用例数据中\n case_data[update_key] = select_result\n \n # 使用RequestMethod类对象发送请求\n res = fix_req.request_all(req_method=method, req_url=url, req_mime=mime, case_data=case_data)\n \n # 断言\n try:\n for key in expect_data.keys():\n assert expect_data[key] == res.json().get(key)\n except AssertionError:\n log.error(f\"断言失败,接口url为:{url}, 用例数据:{case_data}, 期望数据:{expect_data}, 服务器返回数据:{res.text}\")\n> raise AssertionError(\"断言失败\")\nE AssertionError: 断言失败\n\ntest_case\\test_demo\\test_bpm.py:55: AssertionError"}, "attachments": [{"name": "log", "source": "6d70e449-7a32-44d4-bbfc-284b72b87c0f-attachment.txt", "type": "text/plain"}], "parameters": [{"name": "url", "value": "'http://36.139.193.99:8088/api/demension/v1/dem/deleteDemByIds'"}, {"name": "method", "value": "'delete'"}, {"name": "mime", "value": "'query'"}, {"name": "case_data", "value": "{'ids': '需要更新'}"}, {"name": "expect_data", "value": "{'message': '删除维度成功!'}"}, {"name": "sql_type", "value": "'select'"}, {"name": "sql_data", "value": "{'select': 'select ID_ from uc_demension where CODE_=\"requestsAddDem\";'}"}, {"name": "update_key", "value": "'ids'"}], "start": 1725509874074, "stop": 1725509874102, "uuid": "70b06e8b-1bd4-41b5-89dc-2365914c62e6", "historyId": "e2d18f98d0b8345269ccaac9d47e0009", "testCaseId": "2de48645219de93dc51c83a53a42f952", "fullName": "test_case.test_demo.test_bpm.TestBPM#test_bpm", "labels": [{"name": "parentSuite", "value": "test_case.test_demo"}, {"name": "suite", "value": "test_bpm"}, {"name": "subSuite", "value": "TestBPM"}, {"name": "host", "value": "DESKTOP-4FFIKGU"}, {"name": "thread", "value": "17444-MainThread"}, {"name": "framework", "value": "pytest"}, {"name": "language", "value": "cpython3"}, {"name": "package", "value": "test_case.test_demo.test_bpm"}]}
\ No newline at end of file
{"uuid": "781f1d5a-b2d9-48e2-8a95-08ace356df2a", "befores": [{"name": "method", "status": "passed", "start": 1725509874072, "stop": 1725509874072}], "start": 1725509874072, "stop": 1725509874122}
\ No newline at end of file
{"uuid": "308b3805-546b-470c-8411-be56dbc3ce57", "befores": [{"name": "update_key", "status": "passed", "start": 1725509873502, "stop": 1725509873503}], "start": 1725509873502, "stop": 1725509873781}
\ No newline at end of file
{"uuid": "1e132749-7092-40d0-b10b-fb07702e40f5", "children": ["b0ffe29c-5a47-4fc2-9f4c-6348d61a1311", "4f140660-245b-4efb-9908-5bb18fd29495", "d3ad5bb8-3fe1-4e13-a5a3-abcf825786f6", "4bd1a1e9-7b16-45c4-adde-46f218d2a0d9", "c1c9a166-4e8a-4034-af12-642b781f9305", "7b394fb4-02f8-4a3b-910c-cc6907718049", "64c7256a-ca2a-4a5b-83e0-a1a050be1707", "a56e2b22-da2a-4f36-8f48-a0d62e7c9c34", "bfe5ffb6-d54a-4d3a-a70a-a189648896a3", "704580fe-1700-42d0-bdda-536a423482a9", "42e84d51-19dc-4202-ba2b-1c50730ca2c6", "45b57e43-21fc-4409-a400-e5bba2a5a2c0"], "befores": [{"name": "fix_db", "status": "passed", "start": 1725509874827, "stop": 1725509874861}], "afters": [{"name": "fix_db::0", "status": "passed", "start": 1725509875448, "stop": 1725509875448}], "start": 1725509874827, "stop": 1725509875448}
\ No newline at end of file
{"uuid": "8f7324da-5521-4d03-aa6b-b6a2b54e111b", "befores": [{"name": "update_key", "status": "passed", "start": 1725509873793, "stop": 1725509873793}], "start": 1725509873793, "stop": 1725509873829}
\ No newline at end of file
{"uuid": "ca6b98c0-564c-473c-b756-206eb93ab04b", "befores": [{"name": "case_data", "status": "passed", "start": 1725509874073, "stop": 1725509874073}], "start": 1725509874073, "stop": 1725509874120}
\ No newline at end of file
ERROR  张三:test_bpm.py:54 断言失败,接口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}
\ No newline at end of file
{"uuid": "ad8b23f6-a647-43c6-852b-bde1e9ed9198", "befores": [{"name": "update_key", "status": "passed", "start": 1725509875182, "stop": 1725509875182}], "start": 1725509875182, "stop": 1725509875211}
\ No newline at end of file
{"uuid": "486b4e21-5ef4-49a0-a245-57912380fa00", "befores": [{"name": "expect_data", "status": "passed", "start": 1725509873920, "stop": 1725509873920}], "start": 1725509873920, "stop": 1725509873968}
\ No newline at end of file
{"uuid": "7831467d-50fb-4ec2-b76f-e25e439a4484", "befores": [{"name": "case_data", "status": "passed", "start": 1725509875342, "stop": 1725509875342}], "start": 1725509875342, "stop": 1725509875399}
\ No newline at end of file
{"uuid": "0d94321d-b756-41e5-b5ed-6c61b11acc72", "befores": [{"name": "expect_data", "status": "passed", "start": 1725509874896, "stop": 1725509874896}], "start": 1725509874896, "stop": 1725509874929}
\ No newline at end of file
{"uuid": "335d9e9f-a61b-4d54-aa0e-4daa729daa1b", "befores": [{"name": "method", "status": "passed", "start": 1725509875130, "stop": 1725509875130}], "start": 1725509875130, "stop": 1725509875173}
\ No newline at end of file
ERROR  张三:test_bpm.py:54 断言失败,接口url为:http://36.139.193.99:8088/auth, 用例数据:{'username': 'adminxyz', 'password': 'bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ='}, 期望数据:{'message': '账号或密码错误'}, 服务器返回数据:{"state":false,"message":"账户错误或该租户未启用","code":200,"logId":"1831546822473654272"}
\ No newline at end of file
{"uuid": "3429e083-8986-4d39-9b12-4c786765dfb7", "befores": [{"name": "sql_data", "status": "passed", "start": 1725509875408, "stop": 1725509875408}], "start": 1725509875408, "stop": 1725509875442}
\ No newline at end of file
{"uuid": "0b2a02be-45c2-45d5-89f5-8b342ecaf205", "befores": [{"name": "sql_type", "status": "passed", "start": 1725509874032, "stop": 1725509874032}], "start": 1725509874032, "stop": 1725509874064}
\ No newline at end of file
{"uuid": "60a9c65d-51af-40e8-899d-583a589a3add", "befores": [{"name": "update_key", "status": "passed", "start": 1725509874073, "stop": 1725509874073}], "start": 1725509874073, "stop": 1725509874116}
\ No newline at end of file
{"uuid": "c8925578-96bb-43ff-a5aa-d5f0d7b74207", "children": ["b0ffe29c-5a47-4fc2-9f4c-6348d61a1311", "4f140660-245b-4efb-9908-5bb18fd29495", "d3ad5bb8-3fe1-4e13-a5a3-abcf825786f6", "4bd1a1e9-7b16-45c4-adde-46f218d2a0d9", "c1c9a166-4e8a-4034-af12-642b781f9305", "7b394fb4-02f8-4a3b-910c-cc6907718049", "64c7256a-ca2a-4a5b-83e0-a1a050be1707", "a56e2b22-da2a-4f36-8f48-a0d62e7c9c34", "bfe5ffb6-d54a-4d3a-a70a-a189648896a3", "704580fe-1700-42d0-bdda-536a423482a9", "42e84d51-19dc-4202-ba2b-1c50730ca2c6", "45b57e43-21fc-4409-a400-e5bba2a5a2c0"], "befores": [{"name": "fix_req", "status": "passed", "start": 1725509874861, "stop": 1725509874895}], "afters": [{"name": "fix_req::0", "status": "passed", "start": 1725509875446, "stop": 1725509875447}], "start": 1725509874861, "stop": 1725509875447}
\ No newline at end of file
ERROR  张三:test_bpm.py:54 断言失败,接口url为:http://36.139.193.99:8088/auth, 用例数据:{'username': 'admin', 'password': 'bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jznbF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jznbF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jznbF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jznbF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn'}, 期望数据:{'message': '账号或密码错误'}, 服务器返回数据:{"state":false,"message":"解密密码异常,请检查RSA公钥和私钥配置","code":200,"logId":"1831546820259061760"}
\ No newline at end of file
{"uuid": "f251932f-1324-470a-a5c8-18b92c4bf95f", "befores": [{"name": "method", "status": "passed", "start": 1725509874524, "stop": 1725509874524}], "start": 1725509874524, "stop": 1725509874563}
\ No newline at end of file
{"uuid": "e6a9a259-e4ba-4e67-b5d3-a5f861433cfe", "befores": [{"name": "url", "status": "passed", "start": 1725509873792, "stop": 1725509873792}], "start": 1725509873792, "stop": 1725509873833}
\ No newline at end of file
{"uuid": "ed989a8c-9aeb-4ae8-b70f-0069ce2ed0f4", "befores": [{"name": "update_key", "status": "passed", "start": 1725509874287, "stop": 1725509874287}], "start": 1725509874287, "stop": 1725509874329}
\ No newline at end of file
{"uuid": "757057b4-9f6d-4044-9ebd-f679819f8681", "befores": [{"name": "case_data", "status": "passed", "start": 1725509874032, "stop": 1725509874032}], "start": 1725509874032, "stop": 1725509874066}
\ No newline at end of file
{"uuid": "afa2d1de-0135-4429-9a43-f2a5660c3930", "befores": [{"name": "sql_type", "status": "passed", "start": 1725509874706, "stop": 1725509874706}], "start": 1725509874706, "stop": 1725509874764}
\ No newline at end of file
{"name": "test_bpm[http://36.139.193.99:8088/auth-POST-application/json-case_data10-expect_data10-None-None-None]", "status": "failed", "statusDetails": {"message": "AssertionError: 断言失败", "trace": "self = <apiAutoTest_v3.test_case.test_lao_zhang.test_bpm.TestBPM object at 0x0000020876335910>\nfix_db = <apiAutoTest_v3.common.db.DB object at 0x00000208769EE3F0>\nfix_req = <apiAutoTest_v3.request_method.request_method.RequestMethod object at 0x00000208763FE3F0>, url = 'http://36.139.193.99:8088/auth', method = 'POST'\nmime = 'application/json'\ncase_data = {'password': 'bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ', 'username': 'admin'}\nexpect_data = {'message': '账号或密码错误'}, sql_type = None, sql_data = None, update_key = None\n\n @pytest.mark.parametrize(\"url, method, mime, case_data, expect_data, sql_type, sql_data, update_key\", excel.get_data())\n def test_bpm(self, fix_db, fix_req, url, method, mime, case_data, expect_data, sql_type, sql_data, update_key):\n \n # 判断sql语句的类型是否为delete\n if sql_type == \"delete\":\n # 使用DB类对象调用delete方法执行删除的sql语句,DB类对象===fix_db自定义固件\n fix_db.delete(sql_data['delete'])\n \n # 判断sql语句类型是否为select\n elif sql_type == \"select\":\n # 使用DB类对象调用select方法执行查询的sql语句, 并获取查询结果,DB类对象===fix_db自定义固件\n select_result = fix_db.select(sql_data['select'])\n # 将查询结果更新到用例数据中\n case_data[update_key] = select_result\n \n # 判断sql语句的类型是否为select|delete 或者为 delete|select\n elif sql_type == \"select|delete\" or sql_type == \"delete|select\":\n # 使用DB类对象调用delete方法执行删除的sql语句,DB类对象===fix_db自定义固件\n fix_db.delete(sql_data['delete'])\n \n # 使用DB类对象调用select方法执行查询的sql语句, 并获取查询结果,DB类对象===fix_db自定义固件\n select_result = fix_db.select(sql_data['select'])\n # 将查询结果更新到用例数据中\n case_data[update_key] = select_result\n \n # 使用RequestMethod类对象发送请求\n res = fix_req.request_all(req_method=method, req_url=url, req_mime=mime, case_data=case_data)\n \n # 断言\n try:\n for key in expect_data.keys():\n> assert expect_data[key] == res.json().get(key)\nE AssertionError: assert '账号或密码错误' == None\nE + where None = <built-in method get of dict object at 0x0000020876A69800>('message')\nE + where <built-in method get of dict object at 0x0000020876A69800> = {'account': 'admin', 'expiration': 86400, 'loginStatus': True, 'token': 'eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsInRl...UsImlhdCI6MTcyNTUwOTc2NX0.FoJLBa_jfSBAslH-cQrJmmHlRZNx14ddBlmEEnnd6GNbJQdwXCAeUvt5FIqLz_HI1WzuLeFHsMRSdOcW7GfEqw', ...}.get\nE + where {'account': 'admin', 'expiration': 86400, 'loginStatus': True, 'token': 'eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsInRl...UsImlhdCI6MTcyNTUwOTc2NX0.FoJLBa_jfSBAslH-cQrJmmHlRZNx14ddBlmEEnnd6GNbJQdwXCAeUvt5FIqLz_HI1WzuLeFHsMRSdOcW7GfEqw', ...} = json()\nE + where json = <Response [200]>.json\n\ntest_case\\test_lao_zhang\\test_bpm.py:52: AssertionError\n\nDuring handling of the above exception, another exception occurred:\n\nself = <apiAutoTest_v3.test_case.test_lao_zhang.test_bpm.TestBPM object at 0x0000020876335910>\nfix_db = <apiAutoTest_v3.common.db.DB object at 0x00000208769EE3F0>\nfix_req = <apiAutoTest_v3.request_method.request_method.RequestMethod object at 0x00000208763FE3F0>, url = 'http://36.139.193.99:8088/auth', method = 'POST'\nmime = 'application/json'\ncase_data = {'password': 'bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ', 'username': 'admin'}\nexpect_data = {'message': '账号或密码错误'}, sql_type = None, sql_data = None, update_key = None\n\n @pytest.mark.parametrize(\"url, method, mime, case_data, expect_data, sql_type, sql_data, update_key\", excel.get_data())\n def test_bpm(self, fix_db, fix_req, url, method, mime, case_data, expect_data, sql_type, sql_data, update_key):\n \n # 判断sql语句的类型是否为delete\n if sql_type == \"delete\":\n # 使用DB类对象调用delete方法执行删除的sql语句,DB类对象===fix_db自定义固件\n fix_db.delete(sql_data['delete'])\n \n # 判断sql语句类型是否为select\n elif sql_type == \"select\":\n # 使用DB类对象调用select方法执行查询的sql语句, 并获取查询结果,DB类对象===fix_db自定义固件\n select_result = fix_db.select(sql_data['select'])\n # 将查询结果更新到用例数据中\n case_data[update_key] = select_result\n \n # 判断sql语句的类型是否为select|delete 或者为 delete|select\n elif sql_type == \"select|delete\" or sql_type == \"delete|select\":\n # 使用DB类对象调用delete方法执行删除的sql语句,DB类对象===fix_db自定义固件\n fix_db.delete(sql_data['delete'])\n \n # 使用DB类对象调用select方法执行查询的sql语句, 并获取查询结果,DB类对象===fix_db自定义固件\n select_result = fix_db.select(sql_data['select'])\n # 将查询结果更新到用例数据中\n case_data[update_key] = select_result\n \n # 使用RequestMethod类对象发送请求\n res = fix_req.request_all(req_method=method, req_url=url, req_mime=mime, case_data=case_data)\n \n # 断言\n try:\n for key in expect_data.keys():\n assert expect_data[key] == res.json().get(key)\n except AssertionError:\n log.error(f\"断言失败,接口url为:{url}, 用例数据:{case_data}, 期望数据:{expect_data}, 服务器返回数据:{res.text}\")\n> raise AssertionError(\"断言失败\")\nE AssertionError: 断言失败\n\ntest_case\\test_lao_zhang\\test_bpm.py:55: AssertionError"}, "attachments": [{"name": "log", "source": "49ef8e66-cebc-43fd-b7df-3fefd834211c-attachment.txt", "type": "text/plain"}], "parameters": [{"name": "url", "value": "'http://36.139.193.99:8088/auth'"}, {"name": "method", "value": "'POST'"}, {"name": "mime", "value": "'application/json'"}, {"name": "case_data", "value": "{'username': 'admin', 'password': 'bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ'}"}, {"name": "expect_data", "value": "{'message': '账号或密码错误'}"}, {"name": "sql_type", "value": "None"}, {"name": "sql_data", "value": "None"}, {"name": "update_key", "value": "None"}], "start": 1725509874707, "stop": 1725509874750, "uuid": "7f819331-6a84-4060-b123-7df9e83d3906", "historyId": "4365a6de5e8b42ab1bd856faf33b87f7", "testCaseId": "76d35760a932e639b00339c72f742819", "fullName": "test_case.test_lao_zhang.test_bpm.TestBPM#test_bpm", "labels": [{"name": "parentSuite", "value": "test_case.test_lao_zhang"}, {"name": "suite", "value": "test_bpm"}, {"name": "subSuite", "value": "TestBPM"}, {"name": "host", "value": "DESKTOP-4FFIKGU"}, {"name": "thread", "value": "17444-MainThread"}, {"name": "framework", "value": "pytest"}, {"name": "language", "value": "cpython3"}, {"name": "package", "value": "test_case.test_lao_zhang.test_bpm"}]}
\ No newline at end of file
{"uuid": "ec97ba4a-86d5-47c1-bbd5-ef20717df0b6", "befores": [{"name": "mime", "status": "passed", "start": 1725509875030, "stop": 1725509875030}], "start": 1725509875030, "stop": 1725509875074}
\ No newline at end of file
{"uuid": "7dc6f0ca-e73c-4aef-90bf-26157fe2f46d", "befores": [{"name": "sql_type", "status": "passed", "start": 1725509873502, "stop": 1725509873502}], "start": 1725509873502, "stop": 1725509873782}
\ No newline at end of file
{"uuid": "f55e1af2-af3d-4ab0-a541-d023737f8146", "befores": [{"name": "update_key", "status": "passed", "start": 1725509874609, "stop": 1725509874609}], "start": 1725509874609, "stop": 1725509874641}
\ No newline at end of file
{"uuid": "e8610eae-320b-430a-9150-847810580cc4", "befores": [{"name": "sql_type", "status": "passed", "start": 1725509874287, "stop": 1725509874287}], "start": 1725509874287, "stop": 1725509874341}
\ No newline at end of file
{"uuid": "9a85ce74-b793-4bba-a922-4bd4cbc297c9", "befores": [{"name": "sql_type", "status": "passed", "start": 1725509874073, "stop": 1725509874073}], "start": 1725509874073, "stop": 1725509874119}
\ No newline at end of file
{"uuid": "1b9b52b5-5093-4d3d-bead-b817407bbe99", "befores": [{"name": "sql_type", "status": "passed", "start": 1725509873793, "stop": 1725509873793}], "start": 1725509873793, "stop": 1725509873830}
\ No newline at end of file
{"uuid": "0125eb5a-57c8-4d98-82c3-4fa1f02e4319", "befores": [{"name": "update_key", "status": "passed", "start": 1725509875031, "stop": 1725509875031}], "start": 1725509875031, "stop": 1725509875071}
\ No newline at end of file
ERROR  张三:test_bpm.py:54 断言失败,接口url为:http://36.139.193.99:8088/auth, 用例数据:{'username': 'admin', 'password': '123456'}, 期望数据:{'message': '账号或密码错误'}, 服务器返回数据:{"state":false,"message":"解密密码异常,请检查RSA公钥和私钥配置","code":200,"logId":"1831546823161520128"}
\ No newline at end of file
{"uuid": "b678f046-92f7-4df1-a4f4-ae6ea99896d3", "befores": [{"name": "url", "status": "passed", "start": 1725509875030, "stop": 1725509875030}], "start": 1725509875030, "stop": 1725509875075}
\ No newline at end of file
{"uuid": "d81eb0b5-59ea-4f9b-a344-d4e1795d9d58", "befores": [{"name": "sql_data", "status": "passed", "start": 1725509875343, "stop": 1725509875343}], "start": 1725509875343, "stop": 1725509875396}
\ No newline at end of file
{"uuid": "5ed221d5-21e3-40e5-8360-efba4528bc98", "befores": [{"name": "sql_type", "status": "passed", "start": 1725509874462, "stop": 1725509874462}], "start": 1725509874461, "stop": 1725509874517}
\ No newline at end of file
{"uuid": "7b537e50-cef4-47e6-a869-273431b898ae", "befores": [{"name": "method", "status": "passed", "start": 1725509874567, "stop": 1725509874567}], "start": 1725509874567, "stop": 1725509874603}
\ No newline at end of file
{"uuid": "7451fee2-0311-4994-8a73-63f527c7b016", "befores": [{"name": "case_data", "status": "passed", "start": 1725509873920, "stop": 1725509873920}], "start": 1725509873920, "stop": 1725509873969}
\ No newline at end of file
{"uuid": "74e88e80-2a61-48a0-9eb1-a9ce12c06006", "befores": [{"name": "sql_data", "status": "passed", "start": 1725509874243, "stop": 1725509874243}], "start": 1725509874243, "stop": 1725509874280}
\ No newline at end of file
ERROR  张三:test_bpm.py:54 断言失败,接口url为:http://36.139.193.99:8088/auth, 用例数据:{'username': 'admin', 'password': '123456'}, 期望数据:{'message': '账号或密码错误'}, 服务器返回数据:{"state":false,"message":"解密密码异常,请检查RSA公钥和私钥配置","code":200,"logId":"1831546820485554176"}
\ No newline at end of file
ERROR  张三:test_bpm.py:54 断言失败,接口url为:http://36.139.193.99:8088/auth, 用例数据:{'username': 'a', 'password': 'bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ='}, 期望数据:{'message': '账号或密码错误'}, 服务器返回数据:{"state":false,"message":"账户错误或该租户未启用","code":200,"logId":"1831546819416006656"}
\ No newline at end of file
{"uuid": "9ec4e386-7538-4316-a564-e05258f84253", "befores": [{"name": "url", "status": "passed", "start": 1725509874524, "stop": 1725509874524}], "start": 1725509874524, "stop": 1725509874563}
\ No newline at end of file
{"uuid": "4f583377-e88b-4d03-b6a3-67c4ea155742", "befores": [{"name": "case_data", "status": "passed", "start": 1725509873837, "stop": 1725509873837}], "start": 1725509873837, "stop": 1725509873913}
\ No newline at end of file
{"uuid": "97c3b021-5695-468d-8c64-3657a0ab9cdc", "befores": [{"name": "mime", "status": "passed", "start": 1725509874981, "stop": 1725509874981}], "start": 1725509874981, "stop": 1725509875024}
\ No newline at end of file
{"uuid": "4521c350-f19e-4ded-ae57-4d04771002b4", "befores": [{"name": "method", "status": "passed", "start": 1725509874461, "stop": 1725509874461}], "start": 1725509874461, "stop": 1725509874520}
\ No newline at end of file
ERROR  张三:test_bpm.py:54 断言失败,接口url为:http://36.139.193.99:8088/auth, 用例数据:{'username': '#!$!@#!@#', 'password': 'bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQqmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerVlYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ='}, 期望数据:{'message': '账号或密码错误'}, 服务器返回数据:{"state":false,"message":"账户错误或该租户未启用","code":200,"logId":"1831546818946244608"}
\ No newline at end of file
{"uuid": "2533f222-fa58-4d48-b733-e49bd1011c73", "befores": [{"name": "url", "status": "passed", "start": 1725509875301, "stop": 1725509875301}], "start": 1725509875301, "stop": 1725509875338}
\ No newline at end of file
{"name": "test_bpm[http://36.139.193.99:8088/api/demension/v1/dem/addDem-post-application/json-case_data0-expect_data0-delete-sql_data0-None]", "status": "failed", "statusDetails": {"message": "AssertionError: 断言失败", "trace": "self = <apiAutoTest_v3.test_case.test_demo.test_bpm.TestBPM object at 0x0000020876866AB0>, fix_db = <apiAutoTest_v3.common.db.DB object at 0x00000208763FD310>\nfix_req = <apiAutoTest_v3.request_method.request_method.RequestMethod object at 0x0000020876411130>\nurl = 'http://36.139.193.99:8088/api/demension/v1/dem/addDem', method = 'post', mime = 'application/json'\ncase_data = {'code': 'requestsAddDem', 'description': 'requestsAddDem', 'isDefault': 1, 'name': 'requests添加的维度'}, expect_data = {'message': '添加维度成功'}\nsql_type = 'delete', sql_data = {'delete': 'dELETE FROM uc_demension WHERE `CODE_`=\"requestsAddDem\";'}, update_key = None\n\n @pytest.mark.parametrize(\"url, method, mime, case_data, expect_data, sql_type, sql_data, update_key\", excel.get_data())\n def test_bpm(self, fix_db, fix_req, url, method, mime, case_data, expect_data, sql_type, sql_data, update_key):\n \n # 判断sql语句的类型是否为delete\n if sql_type == \"delete\":\n # 使用DB类对象调用delete方法执行删除的sql语句,DB类对象===fix_db自定义固件\n fix_db.delete(sql_data['delete'])\n \n # 判断sql语句类型是否为select\n elif sql_type == \"select\":\n # 使用DB类对象调用select方法执行查询的sql语句, 并获取查询结果,DB类对象===fix_db自定义固件\n select_result = fix_db.select(sql_data['select'])\n # 将查询结果更新到用例数据中\n case_data[update_key] = select_result\n \n # 判断sql语句的类型是否为select|delete 或者为 delete|select\n elif sql_type == \"select|delete\" or sql_type == \"delete|select\":\n # 使用DB类对象调用delete方法执行删除的sql语句,DB类对象===fix_db自定义固件\n fix_db.delete(sql_data['delete'])\n \n # 使用DB类对象调用select方法执行查询的sql语句, 并获取查询结果,DB类对象===fix_db自定义固件\n select_result = fix_db.select(sql_data['select'])\n # 将查询结果更新到用例数据中\n case_data[update_key] = select_result\n \n # 使用RequestMethod类对象发送请求\n res = fix_req.request_all(req_method=method, req_url=url, req_mime=mime, case_data=case_data)\n \n # 断言\n try:\n for key in expect_data.keys():\n> assert expect_data[key] == res.json().get(key)\nE AssertionError: assert '添加维度成功' == '添加维度成功!'\nE \nE - 添加维度成功!\nE ? -\nE + 添加维度成功\n\ntest_case\\test_demo\\test_bpm.py:52: AssertionError\n\nDuring handling of the above exception, another exception occurred:\n\nself = <apiAutoTest_v3.test_case.test_demo.test_bpm.TestBPM object at 0x0000020876866AB0>, fix_db = <apiAutoTest_v3.common.db.DB object at 0x00000208763FD310>\nfix_req = <apiAutoTest_v3.request_method.request_method.RequestMethod object at 0x0000020876411130>\nurl = 'http://36.139.193.99:8088/api/demension/v1/dem/addDem', method = 'post', mime = 'application/json'\ncase_data = {'code': 'requestsAddDem', 'description': 'requestsAddDem', 'isDefault': 1, 'name': 'requests添加的维度'}, expect_data = {'message': '添加维度成功'}\nsql_type = 'delete', sql_data = {'delete': 'dELETE FROM uc_demension WHERE `CODE_`=\"requestsAddDem\";'}, update_key = None\n\n @pytest.mark.parametrize(\"url, method, mime, case_data, expect_data, sql_type, sql_data, update_key\", excel.get_data())\n def test_bpm(self, fix_db, fix_req, url, method, mime, case_data, expect_data, sql_type, sql_data, update_key):\n \n # 判断sql语句的类型是否为delete\n if sql_type == \"delete\":\n # 使用DB类对象调用delete方法执行删除的sql语句,DB类对象===fix_db自定义固件\n fix_db.delete(sql_data['delete'])\n \n # 判断sql语句类型是否为select\n elif sql_type == \"select\":\n # 使用DB类对象调用select方法执行查询的sql语句, 并获取查询结果,DB类对象===fix_db自定义固件\n select_result = fix_db.select(sql_data['select'])\n # 将查询结果更新到用例数据中\n case_data[update_key] = select_result\n \n # 判断sql语句的类型是否为select|delete 或者为 delete|select\n elif sql_type == \"select|delete\" or sql_type == \"delete|select\":\n # 使用DB类对象调用delete方法执行删除的sql语句,DB类对象===fix_db自定义固件\n fix_db.delete(sql_data['delete'])\n \n # 使用DB类对象调用select方法执行查询的sql语句, 并获取查询结果,DB类对象===fix_db自定义固件\n select_result = fix_db.select(sql_data['select'])\n # 将查询结果更新到用例数据中\n case_data[update_key] = select_result\n \n # 使用RequestMethod类对象发送请求\n res = fix_req.request_all(req_method=method, req_url=url, req_mime=mime, case_data=case_data)\n \n # 断言\n try:\n for key in expect_data.keys():\n assert expect_data[key] == res.json().get(key)\n except AssertionError:\n log.error(f\"断言失败,接口url为:{url}, 用例数据:{case_data}, 期望数据:{expect_data}, 服务器返回数据:{res.text}\")\n> raise AssertionError(\"断言失败\")\nE AssertionError: 断言失败\n\ntest_case\\test_demo\\test_bpm.py:55: AssertionError"}, "attachments": [{"name": "log", "source": "11313d8e-3fad-4629-b330-b6abc255f899-attachment.txt", "type": "text/plain"}], "parameters": [{"name": "url", "value": "'http://36.139.193.99:8088/api/demension/v1/dem/addDem'"}, {"name": "method", "value": "'post'"}, {"name": "mime", "value": "'application/json'"}, {"name": "case_data", "value": "{'code': 'requestsAddDem', 'description': 'requestsAddDem', 'isDefault': 1, 'name': 'requests添加的维度'}"}, {"name": "expect_data", "value": "{'message': '添加维度成功'}"}, {"name": "sql_type", "value": "'delete'"}, {"name": "sql_data", "value": "{'delete': 'dELETE FROM uc_demension WHERE `CODE_`=\"requestsAddDem\";'}"}, {"name": "update_key", "value": "None"}], "start": 1725509873503, "stop": 1725509873548, "uuid": "1a799582-7155-40c7-ba3a-f5b10a0c9aa6", "historyId": "a6f6de20f1d47502e15e1b34c901fc80", "testCaseId": "2de48645219de93dc51c83a53a42f952", "fullName": "test_case.test_demo.test_bpm.TestBPM#test_bpm", "labels": [{"name": "parentSuite", "value": "test_case.test_demo"}, {"name": "suite", "value": "test_bpm"}, {"name": "subSuite", "value": "TestBPM"}, {"name": "host", "value": "DESKTOP-4FFIKGU"}, {"name": "thread", "value": "17444-MainThread"}, {"name": "framework", "value": "pytest"}, {"name": "language", "value": "cpython3"}, {"name": "package", "value": "test_case.test_demo.test_bpm"}]}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
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