Page:
Local-Development-and-Verification
Pages
Admin-Architecture
Admin-Catalog-Integration-API
Admin-Client-API
Admin-Data-Model
Admin-Device-Registration-Guide
Admin-Getting-Started
Admin-Glossary
Admin-Quality-Security
Admin-Requirements
Admin-SQLite-to-MySQL
Admin-Shunyunbao-API
Admin-UI-Specification
Architecture-and-Code-Map
Audience-Document-Template
Business-Rules-and-Glossary
Client-Admin-API-Contract
Client-Architecture
Client-Data-Model
Client-Getting-Started
Client-Glossary
Client-Quality-Security
Client-Requirements
Client-UI-Specification
Common-Changes
Delivery-Documentation-Guide
Deployment-Template
Deployment-and-Operations
Development-Workflow
Home
Local-Development-and-Verification
Product-Requirements-Overview
Project-Profile
Task-Archive-Template
Troubleshooting
Clone
This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
本地开发与验证
环境要求
| 部分 | 固定环境 |
|---|---|
| Admin | Go 1.23.0、MySQL 8.4 |
| Client | Windows、Python 3.10、PyQt5 5.15.11、uiautomator2 3.2.5 |
| Wiki/Harness | Python 3.10,使用标准库 |
| Android | 已安装 PDD App;真实自动化只在明确授权的真机验证中运行 |
真实凭据只从被忽略的配置或安全环境读取,不复制到命令、文档和工单。
第一次运行
Admin
从仓库根目录可运行 run_admin.bat。需要手动开发时:
cd D:\chengma\cmautobuy\admin
go mod download
$env:GOTOOLCHAIN="go1.23.0"
go run .
预期日志显示数据目录和监听地址。连接线上 MySQL 会产生真实数据读取/写入,普通测试应使用名称以 _test 结尾的独立库。
Client
cd D:\chengma\cmautobuy\client
C:/Python310/python.exe -m pip install -r requirements.txt
C:/Python310/python.exe buyer_main.py
只打开窗口不会自动连接设备或下单;点击领取和采购相关命令会产生真实外部操作。
常用调试方式
- 先运行最小测试,再扩大到子项目完整测试。
- Admin handler 错误先看 HTTP 状态、稳定错误码和服务日志,再查 service/repository。
- Client 自动化错误优先使用脱敏 XML 固件和截图复现,避免反复真机下单。
- 修改 Wiki 后只从在线页面同步:
python dev_scripts/harness.py sync --verify
- 查看工作区时使用
git status --short,只暂存当前工单文件。
完成修改前
Admin:
cd D:\chengma\cmautobuy\admin
$env:GOTOOLCHAIN="go1.23.0"
go vet ./...
go build ./...
go test ./... -count=1
Remove-Item Env:GOTOOLCHAIN
Client:
cd D:\chengma\cmautobuy\client
C:/Python310/python.exe -m unittest discover -s test -v
工作流和 Wiki:
cd D:\chengma\cmautobuy
python -m unittest discover -s tests -v
python dev_scripts/harness.py check --strict
python dev_scripts/harness.py sync --check
涉及真机、生产 MySQL、外部 ERP、部署或真实下单时,工单必须单独写明是否验证;没有执行就明确记录“未验证”,不能用单元测试代替。