Commit dc69c8e4 by HM

update_v1.0

parent d3796025
...@@ -9,19 +9,20 @@ ...@@ -9,19 +9,20 @@
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
import pymysql import pymysql
from apiAutoTest_v3 import log from apiAutoTest_v3 import log
from apiAutoTest_v3.common.basic_read_ini import ReadIni from apiAutoTest_v3.common.read_project_ini import ReadProjectIni
class DB: class DB:
def __init__(self): def __init__(self):
"""链接数据库,获取链接对象和游标对象""" """链接数据库,获取链接对象和游标对象"""
ini = ReadIni() # 链接数据库,数据库的连续配置信息存放在项目的配置文件中的,需要使用ReadProjectIni类对象调用get_sql_connect_msg方法
pro_ini = ReadProjectIni()
self.conn = pymysql.connect( self.conn = pymysql.connect(
host=ini.get_sql_connect_msg("host"), host=pro_ini.get_sql_connect_msg("host"),
port=int(ini.get_sql_connect_msg("port")), port=int(pro_ini.get_sql_connect_msg("port")),
user=ini.get_sql_connect_msg("user"), user=pro_ini.get_sql_connect_msg("user"),
password=ini.get_sql_connect_msg("password"), password=pro_ini.get_sql_connect_msg("password"),
database=ini.get_sql_connect_msg("database"), database=pro_ini.get_sql_connect_msg("database"),
charset="utf8" charset="utf8"
) )
self.cursor = self.conn.cursor() self.cursor = self.conn.cursor()
......
...@@ -8,24 +8,30 @@ ...@@ -8,24 +8,30 @@
# #
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
import openpyxl import openpyxl
from apiAutoTest_v3 import log from apiAutoTest_v3 import log
from apiAutoTest_v3.common.read_json import read_json from apiAutoTest_v3.common.read_json import read_json
from apiAutoTest_v3.common.user_read_ini import ReadIni from apiAutoTest_v3.common.read_project_ini import ReadProjectIni
from apiAutoTest_v3.common.basic_read_ini import ReadIni as BasicIni from apiAutoTest_v3.common.read_user_ini import ReadUserIni
from apiAutoTest_v3.data_config.settings import * from apiAutoTest_v3.data_config.settings import *
# read_excel.py文件的功能:就是获取每个用户的测试数据,并将测试数据存放在一个二维列表中
class ReadExcel: class ReadExcel:
def __init__(self, username="demo"): def __init__(self, user_dir_name):
"""获取所有json文件的路径,并读取json文件,再获取excel文件的路径,加载excel的工作簿,并获取工作表的名称,再获取工作表""" """获取所有json文件的路径,并读取json文件,再获取excel文件的路径,加载excel的工作簿,并获取工作表的名称,再获取工作表"""
self.ini = ReadIni(username) # 被测系统的域名存放在项目的ini配置文件中,所有需要ReadProjectIni对象,调用get_host方法获取被测系统的域名
case_data_path = self.ini.get_file_path(FILE_CASE) self.pro_ini = ReadProjectIni()
expect_data_path = self.ini.get_file_path(FILE_EXPECT) # 先读取每个用户的配置文件的对象。ReadUserIni对象。因为每个用户的数据存放的文件信息放在每个用户的ini配置文件中。
sql_data_path = self.ini.get_file_path(FILE_SQL) user_ini = ReadUserIni(user_dir_name)
# 根据ReadUserIni对象获取每个用户的数据文件路径
excel_path = self.ini.get_file_path(FILE_EXCEL) case_data_path = user_ini.get_file_path(FILE_CASE)
table_name = self.ini.get_table_name(TABLE_kEY) 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.case_data_dict = read_json(case_data_path)
self.expect_data_dict = read_json(expect_data_path) self.expect_data_dict = read_json(expect_data_path)
...@@ -63,7 +69,8 @@ class ReadExcel: ...@@ -63,7 +69,8 @@ class ReadExcel:
"""根据行号,获取用例的url""" """根据行号,获取用例的url"""
path = self.__get_cell_value(URL, row) path = self.__get_cell_value(URL, row)
if path: if path:
return BasicIni().get_host(HOST_KEY) + path # 被测系统的域名存放在项目的ini配置文件中,所有需要ReadProjectIni对象,调用get_host方法获取被测系统的域名
return self.pro_ini.get_host(HOST_KEY) + path
def case_req_method(self, row): def case_req_method(self, row):
"""根据行号,获取用例的请求方法""" """根据行号,获取用例的请求方法"""
......
# -*-coding:utf-8 -*- # # -*-coding:utf-8 -*- #
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# ProjectName: test62 # ProjectName: test62
# FileName: read_ini.py # FileName: read_project_ini.py
# Author: lao_zhao # Author: lao_zhao
# Datetime: 2024/9/4 14:17 # Datetime: 2024/9/6 17:03
# Description: # Description:
# #
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
import configparser import configparser
import os import os
from apiAutoTest_v3 import log from apiAutoTest_v3 import log
class ReadIni: class ReadProjectIni:
def __init__(self): def __init__(self):
"""获取ini文件的路径,并读取ini""" """获取ini文件的路径,并读取ini"""
self.data_config = os.path.join(os.path.dirname(os.path.dirname(__file__)), "data_config") 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") # 获取项目配置ini文件的路径
ini_path = os.path.join(self.data_config, "project_config.ini")
self.conf = configparser.ConfigParser() self.conf = configparser.ConfigParser()
self.conf.read(ini_path, encoding="utf-8") self.conf.read(ini_path, encoding="utf-8")
...@@ -36,6 +38,3 @@ class ReadIni: ...@@ -36,6 +38,3 @@ class ReadIni:
log.error(f"方法get_sql_connect_msg执行失败,形参key传参为:{key},错误为:{e}") log.error(f"方法get_sql_connect_msg执行失败,形参key传参为:{key},错误为:{e}")
raise e raise e
if __name__ == '__main__':
ini = ReadIni()
\ No newline at end of file
...@@ -12,11 +12,14 @@ import os ...@@ -12,11 +12,14 @@ import os
from apiAutoTest_v3 import log from apiAutoTest_v3 import log
class ReadIni: class ReadUserIni:
def __init__(self, username): def __init__(self, user_dir_name):
"""获取ini文件的路径,并读取ini""" """获取ini文件的路径,并读取ini"""
# 获取数据配置层的目录路径
data_config = os.path.join(os.path.dirname(os.path.dirname(__file__)), "data_config") data_config = os.path.join(os.path.dirname(os.path.dirname(__file__)), "data_config")
self.user_dir = os.path.join(data_config, username) # 获取存放用户数据的目录路径
self.user_dir = os.path.join(data_config, user_dir_name)
# 拼接用户的ini文件路径
ini_path = os.path.join(self.user_dir, "config.ini") ini_path = os.path.join(self.user_dir, "config.ini")
self.conf = configparser.ConfigParser() self.conf = configparser.ConfigParser()
self.conf.read(ini_path, encoding="utf-8") self.conf.read(ini_path, encoding="utf-8")
...@@ -42,5 +45,7 @@ class ReadIni: ...@@ -42,5 +45,7 @@ class ReadIni:
if __name__ == '__main__': if __name__ == '__main__':
ini = ReadIni() ini = ReadUserIni("demo")
# D:\Project\PythonDoc\test62\test62\apiAutoTest_v3\data_config\demo\apiAutoTest.xlsx
# D:\Project\PythonDoc\test62\test62\apiAutoTest_v3\data_config\demo\apiAutoTest.xlsx
print(ini.get_file_path("excel")) print(ini.get_file_path("excel"))
\ No newline at end of file
[file] [file]
# 配置数据配置层中文件的名称 # 配置数据配置层中文件的名称
excel=apiAutoTest.xlsx excel=apiAutoTest.xlsx
...@@ -10,3 +9,4 @@ sql=sql_data.json ...@@ -10,3 +9,4 @@ sql=sql_data.json
[table] [table]
# 配置工作表名称 # 配置工作表名称
table_name=BPM table_name=BPM
...@@ -2,11 +2,14 @@ ...@@ -2,11 +2,14 @@
[file] [file]
# 配置数据配置层中文件的名称 # 配置数据配置层中文件的名称
excel=张三.xlsx excel=老张的用例管理文件.xlsx
case=用例数据.json case=老张的用例数据文件.json
expect=期望数据.json expect=老张的期望数据文件.json
sql=sql_data.json sql=老张的sql语句文件.json
[table] [table]
# 配置工作表名称 # 配置工作表名称
table_name=张三-认证接口 table_name=登录和添加维度的用例
{
{ {
"维度管理": { "维度管理": {
"添加维度": { "添加维度": {
"AddDemSuccess": {"delete": "dELETE FROM uc_demension WHERE `CODE_`=\"requestsAddDem\";"} "AddDemSuccess": "dELETE FROM uc_demension WHERE `CODE_`=\"requestsAddDem\";"
}, },
"根据维度编码删除维度": { "根据维度编码删除维度": {
"DeleteDemSuccess": {"select": "select ID_ from uc_demension where CODE_=\"requestsAddDem\";"} "DeleteDemSuccess": "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\";"
}
}
}
} }
{ {
...@@ -26,23 +26,6 @@ ...@@ -26,23 +26,6 @@
}, },
"根据维度编码删除维度": { "根据维度编码删除维度": {
"DeleteDemSuccess": {"message": "删除维度成功!"} "DeleteDemSuccess": {"message": "删除维度成功!"}
},
"更新维度": {
"UpdateDemSuccess": {"message": "更新维度成功"}
}
},
"组织管理": {
"添加组织": {
"AddOrgSuccess": {"message": "添加组织成功"}
},
"用户加入组织": {
"OrgAddUserSuccess": {"message":"加入成功"}
},
"保存组织参数": {
"SaveOrgparamsSuccess": {"message":"保存组织参数成功!"}
},
"删除组织": {
"DeleteOrgSuccess": {"message":"删除组织成功!"}
} }
} }
} }
{ {
...@@ -23,41 +23,6 @@ ...@@ -23,41 +23,6 @@
}, },
"根据维度编码删除维度": { "根据维度编码删除维度": {
"DeleteDemSuccess": {"ids": "需要更新"} "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"
} }
} }
} }
[host] [host]
# 配置被测系统的域名 # 配置被测系统的域名
bpm_host=http://36.139.193.99:8088 bpm_host=http://36.139.193.99:8088
......
2024-09-05 11:25:19,991 - user_read_ini.py[line:27] - INFO: 执行方法get_file_path为:根据key获取file节点下key对应文件的路径,形参key的传参为case, -- 张三
2024-09-05 11:25:19,991 - user_read_ini.py[line:27] - INFO: 执行方法get_file_path为:根据key获取file节点下key对应文件的路径,形参key的传参为expect, -- 张三
2024-09-05 11:25:19,991 - user_read_ini.py[line:27] - INFO: 执行方法get_file_path为:根据key获取file节点下key对应文件的路径,形参key的传参为sql, -- 张三
2024-09-05 11:25:19,991 - user_read_ini.py[line:27] - INFO: 执行方法get_file_path为:根据key获取file节点下key对应文件的路径,形参key的传参为excel, -- 张三
2024-09-05 11:25:20,026 - user_read_ini.py[line:27] - INFO: 执行方法get_file_path为:根据key获取file节点下key对应文件的路径,形参key的传参为case, -- 张三
2024-09-05 11:25:20,026 - user_read_ini.py[line:27] - INFO: 执行方法get_file_path为:根据key获取file节点下key对应文件的路径,形参key的传参为expect, -- 张三
2024-09-05 11:25:20,026 - user_read_ini.py[line:27] - INFO: 执行方法get_file_path为:根据key获取file节点下key对应文件的路径,形参key的传参为sql, -- 张三
2024-09-05 11:25:20,026 - user_read_ini.py[line:27] - INFO: 执行方法get_file_path为:根据key获取file节点下key对应文件的路径,形参key的传参为excel, -- 张三
2024-09-05 11:25:20,282 - test_bpm.py[line:54] - 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} -- 张三
2024-09-05 14:43:19,036 - user_read_ini.py[line:27] - INFO: 执行方法get_file_path为:根据key获取file节点下key对应文件的路径,形参key的传参为case, -- 张三
2024-09-05 14:43:19,037 - user_read_ini.py[line:27] - INFO: 执行方法get_file_path为:根据key获取file节点下key对应文件的路径,形参key的传参为expect, -- 张三
2024-09-05 14:43:19,037 - user_read_ini.py[line:27] - INFO: 执行方法get_file_path为:根据key获取file节点下key对应文件的路径,形参key的传参为sql, -- 张三
2024-09-05 14:43:19,037 - user_read_ini.py[line:27] - INFO: 执行方法get_file_path为:根据key获取file节点下key对应文件的路径,形参key的传参为excel, -- 张三
2024-09-05 14:43:19,078 - user_read_ini.py[line:27] - INFO: 执行方法get_file_path为:根据key获取file节点下key对应文件的路径,形参key的传参为case, -- 张三
2024-09-05 14:43:19,078 - user_read_ini.py[line:27] - INFO: 执行方法get_file_path为:根据key获取file节点下key对应文件的路径,形参key的传参为expect, -- 张三
2024-09-05 14:43:19,078 - user_read_ini.py[line:27] - INFO: 执行方法get_file_path为:根据key获取file节点下key对应文件的路径,形参key的传参为sql, -- 张三
2024-09-05 14:43:19,078 - user_read_ini.py[line:27] - INFO: 执行方法get_file_path为:根据key获取file节点下key对应文件的路径,形参key的传参为excel, -- 张三
...@@ -9,13 +9,14 @@ ...@@ -9,13 +9,14 @@
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
import requests import requests
from apiAutoTest_v3.common.basic_read_ini import ReadIni from apiAutoTest_v3.common.read_project_ini import ReadProjectIni
class RequestMethod: class RequestMethod:
def __init__(self): def __init__(self):
"""关联登录成功的token""" """关联登录成功的token"""
login_url = ReadIni().get_host("bpm_host") + "/auth" # 被测系统的域名存放在项目的ini配置文件中,所有需要ReadProjectIni对象,调用get_host方法获取被测系统的域名
login_url = ReadProjectIni().get_host("bpm_host") + "/auth"
login_data = {"username": "admin", "password": "bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQ" login_data = {"username": "admin", "password": "bF6N3L93cX8pV6x2yEqxNjwIIPaEOYw9bNI5GuIY4g9MeoFyPFPL5WteHaV0LcxQ"
"qmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerV" "qmDJWlhuCRMXzAPvrFcxJrA8BgGjJpmB1WMrQrazIJPbWbCfmDit2s2jzn+DRerV"
"lYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ="} "lYIFojDM96y24drEniwWzHtaJKiWoc7LGL1csNmokvQ="}
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# ProjectName: test62 # ProjectName: test62
# FileName: __init__.py # FileName: __init__.py
# Author: lao_zhao # Author: lao_zhao
# Datetime: 2024/9/4 14:01 # Datetime: 2024/9/6 17:25
# Description: # Description:
# #
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
...@@ -3,9 +3,12 @@ ...@@ -3,9 +3,12 @@
# ProjectName: test62 # ProjectName: test62
# FileName: __init__.py # FileName: __init__.py
# Author: lao_zhao # Author: lao_zhao
# Datetime: 2024/9/4 17:32 # Datetime: 2024/9/4 14:01
# Description: # Description:
# #
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# user_data_dir_name就是用户存放数据的目录名称
# user_data_dir_name = "demo"
# namespace也是用户存放数据的目录名称
namespace = "demo" namespace = "demo"
\ No newline at end of file
...@@ -13,6 +13,8 @@ from apiAutoTest_v3 import log ...@@ -13,6 +13,8 @@ from apiAutoTest_v3 import log
from apiAutoTest_v3.common.read_excel import ReadExcel from apiAutoTest_v3.common.read_excel import ReadExcel
from apiAutoTest_v3.test_case.test_demo import namespace from apiAutoTest_v3.test_case.test_demo import namespace
# 创建ReadExcel对象,便于获取用户的测试数据,所有创建ReadExcel对象时需要传入用户存放数据的目录名称
excel = ReadExcel(namespace) excel = ReadExcel(namespace)
......
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: test62
# FileName: __init__.py
# Author: lao_zhao
# Datetime: 2024/9/2 17:33
# Description:
#
# ---------------------------------------------------------------------------
host = 'http://36.139.193.99:8088'
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: test62
# FileName: conftest.py
# Author: lao_zhao
# Datetime: 2024/9/2 16:54
# Description:
#
# ---------------------------------------------------------------------------
import pytest
import requests
from apiAutoTest_v3.common.db import DB
@pytest.fixture(scope="session")
def fix_req():
# 创建Session对象
sess = requests.sessions.Session()
yield sess
@pytest.fixture(scope="session")
def fix_db():
db = DB()
yield db
db.close()
@pytest.fixture(scope="session")
def fix_dependency():
dependency_dict = {}
yield dependency_dict
#
# def pytest_collection_modifyitems(items):
# # item表示每个测试用例,解决用例名称中文显示问题
# for item in items:
# item.name = item.name.encode("utf-8").decode("unicode-escape")
# item._nodeid = item._nodeid.encode("utf-8").decode("unicode-escape")
\ No newline at end of file
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: test62
# FileName: test_bpm_login.py
# Author: lao_zhao
# Datetime: 2024/9/2 17:31
# Description:
#
# ---------------------------------------------------------------------------
import allure
import pytest
class TestBPMLogin:
host = 'http://36.139.193.99:8088'
@allure.epic("BPM系统-场景测试")
@allure.feature("认证接口")
@allure.story("登录系统")
@allure.title("登录系统-正向用例")
@allure.severity("高")
@pytest.mark.dependency(scope="session")
def test_login(self, fix_req):
# 构造登录数据
login_url = self.host + '/auth'
login_data = {
"username": "admin", "password": "e6sFAeI1rLdzBgm3WzD/294rAtu9uI+0JSwNEexkatU+Pdzx8Y0qxGQyYy4"
"xTtGos4fDe2WSUtDkO2v8ri1u66TFGr2+EuUGdo1hKadDbbmroUjeZk07s"
"d4qhbuV740TLTdL7uHpg7Fod4MWDwSsMmg/EaFFahjKRCjNGPsV5Rw="}
# 使用Session对象发送请求,Session对象就是fix_req自定义固件
res = fix_req.request(method="post", url=login_url, json=login_data)
try:
assert "超级管理" in res.text
except AssertionError:
print("登录接口有bug")
raise AssertionError("断言失败")
else:
# 更新token到Session对象的headers中
fix_req.headers["Authorization"] = f"Bearer {res.json().get('token')}"
\ No newline at end of file
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: test62
# FileName: test_bpm.py
# Author: lao_zhao
# Datetime: 2024/9/2 16:55
# Description:
#
# ---------------------------------------------------------------------------
import allure
import pytest
class TestBPMDem:
host = 'http://36.139.193.99:8088'
@allure.epic("BPM系统-场景测试")
@allure.feature("维度管理")
@allure.story("添加维度")
@allure.title("添加维度-正向用例")
@allure.severity("高")
@pytest.mark.dependency(depends=['test_case/test_dependency/test_bpm_1_login.py::TestBPMLogin::test_login'], scope="session")
def test_add_dem(self, fix_req, fix_db, fix_dependency):
# 判断Session对象中是否有token,如果有再添加维度,如果没有之间报错
if "Authorization" in list(fix_req.headers.keys()):
# 配置添加维度的数据
add_dem_url = self.host + "/api/demension/v1/dem/addDem"
add_dem_data = {
"code": "testAddDem",
"description": "testAddDem",
"isDefault": 0,
"name": "测试添加的维度"
}
# 添加维度之前需要删除数据库中已存在的维度
fix_db.delete("""delete from uc_demension where CODE_="testAddDem";""")
# 发送请求
res = fix_req.request(method="post", url=add_dem_url, json=add_dem_data)
# 断言
try:
assert "添加维度成功" in res.text
except AssertionError:
raise AttributeError("断言失败")
else:
dem_id = fix_db.select("""select ID_ from uc_demension where CODE_="testAddDem";""")
fix_dependency["demId"] = dem_id
else:
raise ValueError("Session对象中没有token")
if __name__ == '__main__':
pytest.main()
\ No newline at end of file
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName: test62
# FileName: test_bpm_3_org.py
# Author: lao_zhao
# Datetime: 2024/9/3 9:45
# Description:
#
# ---------------------------------------------------------------------------
import allure
import pytest
from study_test_api.study_pytest_test.test_01 import test_example
class TestBPMOrg:
@allure.epic("BPM系统-场景测试")
@allure.feature("组织管理")
@allure.story("添加组织")
@allure.title("添加组织-正向用例")
@allure.severity("高")
@pytest.mark.dependency(depends=["test_case/test_dependency/test_bpm_1_login.py::TestBPMLogin::test_login", "test_case/test_dependency/test_bpm_2_dem.py::TestBPMDem::test_add_dem"], scope="package")
def test_add_org(self, fix_req, fix_dependency, fix_db):
add_org_url = test_example.host + "/api/org/v1/org/addOrg"
add_org_data = {
"code": "testAddOrg",
"demId": fix_dependency["demId"],
"exceedLimitNum": 0,
"grade": "",
"limitNum": 0,
"name": "测试添加的组织",
"nowNum": 0,
"orderNo": 0,
"parentId": "0"
}
fix_db.delete("""delete from uc_org where CODE_="testAddOrg";""")
res = fix_req.request(method="post", url=add_org_url, json=add_org_data)
try:
assert "成功" in res.text
except AssertionError:
print("断言失败")
raise AssertionError("断言失败")
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# ProjectName: test62 # ProjectName: test62
# FileName: __init__.py # FileName: __init__.py
# Author: lao_zhao # Author: lao_zhao
# Datetime: 2024/9/4 17:33 # Datetime: 2024/9/6 17:30
# Description: # Description:
# #
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
......
...@@ -27,8 +27,4 @@ def fix_req(): ...@@ -27,8 +27,4 @@ def fix_req():
yield req yield req
# def pytest_collection_modifyitems(items):
# # item表示每个测试用例,解决用例名称中文显示问题
# for item in items:
# item.name = item.name.encode("utf-8").decode("unicode-escape")
# item._nodeid = item._nodeid.encode("utf-8").decode("unicode-escape")
\ No newline at end of file
...@@ -7,18 +7,20 @@ ...@@ -7,18 +7,20 @@
# Description: # Description:
# #
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
import allure
import pytest import pytest
import allure
from apiAutoTest_v3 import log from apiAutoTest_v3 import log
from apiAutoTest_v3.common.read_excel import ReadExcel from apiAutoTest_v3.common.read_excel import ReadExcel
from apiAutoTest_v3.test_case.test_lao_zhang import namespace from apiAutoTest_v3.test_case.test_zhang import namespace
# 创建ReadExcel对象,便于获取用户的测试数据,所有创建ReadExcel对象时需要传入用户存放数据的目录名称
excel = ReadExcel(namespace) excel = ReadExcel(namespace)
class TestBPM: class TestBPM:
@allure.epic("BPM项目-老张")
@allure.epic("BPM项目-Demo")
# @allure.feature("模块名称") # @allure.feature("模块名称")
# @allure.story("接口名称") # @allure.story("接口名称")
# @allure.title("用例标题") # @allure.title("用例标题")
......
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