feat: 新增JoyHub UI自动化测试目录
1. 新增 Joyhub_ui_auto_test/ 目录: - tests/ - 测试用例目录 - pages/ - 页面元素定位 - config/ - 配置文件 - utils/ - 工具类 - test_data/ - 测试数据 - reports/ - 测试报告 - webapp-testing/ - WebApp测试相关 2. 配置文件: - pytest.ini - pytest配置 - requirements.txt - 依赖列表 - README.md - 项目说明
This commit is contained in:
0
Joyhub_ui_auto_test/utils/__init__.py
Normal file
0
Joyhub_ui_auto_test/utils/__init__.py
Normal file
25
Joyhub_ui_auto_test/utils/logger.py
Normal file
25
Joyhub_ui_auto_test/utils/logger.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
REPORTS_DIR = Path(__file__).resolve().parents[1] / "reports"
|
||||
LOG_FILE = REPORTS_DIR / "test_run.log"
|
||||
|
||||
|
||||
def get_logger(name: str = "ui-test") -> logging.Logger:
|
||||
REPORTS_DIR.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
logger = logging.getLogger(name)
|
||||
if not logger.handlers:
|
||||
formatter = logging.Formatter("%(asctime)s [%(levelname)s] %(name)s - %(message)s")
|
||||
|
||||
stream_handler = logging.StreamHandler()
|
||||
stream_handler.setFormatter(formatter)
|
||||
logger.addHandler(stream_handler)
|
||||
|
||||
file_handler = logging.FileHandler(LOG_FILE, encoding="utf-8")
|
||||
file_handler.setFormatter(formatter)
|
||||
logger.addHandler(file_handler)
|
||||
|
||||
logger.setLevel(logging.INFO)
|
||||
return logger
|
||||
Reference in New Issue
Block a user