mirror of
https://github.com/hpd840321/starRiverProperty.git
synced 2026-06-09 16:30:29 +08:00
038f846dad
- docs/elevator-api-parity: 计划/报告模板/示例 - tools/elevator_api_parity: 端点目录、fixtures、对拍 client/compare、报告生成 - scripts/run_elevator_parity: JDK8 构建 + 单测/对拍(无服务时跳过对拍用例) Made-with: Cursor Former-commit-id: 3d54a40e1a7ae0b1724261d4f18910a6f415f853
1.7 KiB
1.7 KiB
elevator_api_parity — 新旧 JAR 接口对拍
环境
- Python 3.8+
- 安装:
pip install -r requirements.txt(在本目录下执行)
环境说明
本机若安装过 allure_pytest 等全局 pytest 插件且与 Python 版本冲突,请执行:
export PYTEST_DISABLE_PLUGIN_AUTOLOAD=1(run_elevator_parity.sh 已自动设置)后再跑 pytest。
快速使用
- 构建新 JAR(在 reactor 根目录、JDK8)
mvn -DskipTests clean package
得到:../cw-elevator-application-starter/target/cw-elevator-application-2.0.0.jar - 将历史 JAR 放到
cw-elevator-application-V1.0.0.20211103/cw-elevator-application-V1.0.0.20211103.jar或设ELEVATOR_JAR_LEGACY。 - 准备与现网相同的
application.yml(或目录),如ELEVATOR_SPRING_CONFIG=file:/path/to/application-elevator.yml。 - 从仓库反编译根或本目录执行:
../../scripts/run_elevator_parity.sh(见该脚本内环境变量说明)
或手动启动两实例后:
export ELEVATOR_BASE_OLD=http://127.0.0.1:18080
export ELEVATOR_BASE_NEW=http://127.0.0.1:18081
export ELEVATOR_HEADER_BUSINESSID=... # 与现网/联调一致
# ...
cd tools/elevator_api_parity
python -m pytest tests/ -v --tb=short
配置
api_catalog.json:对拍端点、方法、fixture 文件名、说明。fixtures/*.json:各接口请求体。- 归一化忽略键可扩展
parity/compare.py中DEFAULT_STRIP_PATHS(如data.rows内动态字段,谨慎)。
报告
report/parity-YYYYMMDD-HHMMSS.md:实跑时由conftest的 session hook 与report/generate_report.py组合生成。- JUnit(可选):
--junitxml=report/junit.xml