feat: 新增JoyHub模块测试用例和功能增强
1. 新增模块测试用例: - News分类接口测试 (Joyhub_NewsCate.py) - News内容接口测试 (Joyhub_News.py) - 产品分类接口测试 (Joyhub_ProductCate.py) - 产品属性接口测试 (Joyhub_ProductAttr.py) - 产品管理接口测试 (Joyhub_Product.py) - FAQ分类接口测试 (Joyhub_FaqCate.py) - FAQ内容接口测试 (Joyhub_Faq.py) - 博客分类接口测试 (Joyhub_BlogCate.py) - 地址国家接口测试 (Joyhub_AddressCountry.py) - 下载二维码接口测试 (Joyhub_DownloadQrcode.py) - 支付页产品推荐接口测试 (Joyhub_ProductPaymentRecommend.py) 2. 新增业务关键字层: - NewsCateManage.py - NewsManage.py - ProductCateManage.py - ProductAttrManage.py - ProductManage.py - FaqCateManage.py - FaqManage.py - BlogCateManage.py - AddressCountryManage.py - DownloadQrcodeManage.py - ProductPaymentRecommendManage.py 3. 接口层增强: - Dlizhan_interface.py 添加JoyHub相关接口封装 4. 功能增强: - run_tests.py 添加自动清除旧测试结果和报告功能 - Joyhub_Product.py 添加数据库连接获取运费模板ID和品牌ID 5. 修复: - 修复产品创建测试用例缺少前置数据问题
This commit is contained in:
@@ -7,6 +7,7 @@ import argparse
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import shutil
|
||||
|
||||
# 添加项目根目录到 Python 路径
|
||||
current_file_path = os.path.abspath(__file__)
|
||||
@@ -29,6 +30,36 @@ ALLURE_PATH = os.path.join(project_root, 'allure', 'allure-2.28.0', 'bin', 'allu
|
||||
print(ALLURE_REPORT_DIR)
|
||||
|
||||
|
||||
def clean_old_results():
|
||||
"""清除旧的测试结果和报告"""
|
||||
print("清除旧的测试结果和报告...")
|
||||
|
||||
# 清除 allure-results 目录
|
||||
if os.path.exists(ALLURE_RESULTS_DIR):
|
||||
try:
|
||||
shutil.rmtree(ALLURE_RESULTS_DIR)
|
||||
print(f"已清除目录: {ALLURE_RESULTS_DIR}")
|
||||
except Exception as e:
|
||||
print(f"清除 {ALLURE_RESULTS_DIR} 失败: {e}")
|
||||
|
||||
# 清除 allure-report 目录
|
||||
if os.path.exists(ALLURE_REPORT_DIR):
|
||||
try:
|
||||
shutil.rmtree(ALLURE_REPORT_DIR)
|
||||
print(f"已清除目录: {ALLURE_REPORT_DIR}")
|
||||
except Exception as e:
|
||||
print(f"清除 {ALLURE_REPORT_DIR} 失败: {e}")
|
||||
|
||||
# 清除 .pytest_cache 目录
|
||||
pytest_cache_dir = os.path.join(project_root, '.pytest_cache')
|
||||
if os.path.exists(pytest_cache_dir):
|
||||
try:
|
||||
shutil.rmtree(pytest_cache_dir)
|
||||
print(f"已清除目录: {pytest_cache_dir}")
|
||||
except Exception as e:
|
||||
print(f"清除 {pytest_cache_dir} 失败: {e}")
|
||||
|
||||
|
||||
def ensure_dirs():
|
||||
"""确保报告目录存在"""
|
||||
os.makedirs(ALLURE_RESULTS_DIR, exist_ok=True)
|
||||
@@ -211,6 +242,9 @@ def main():
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# 清除旧的测试结果和报告
|
||||
clean_old_results()
|
||||
|
||||
# 确保目录存在
|
||||
ensure_dirs()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user