Files
jerryandClaude Fable 5 5888e1d5c1 test(docgen): 测试治理资产——131 条验收用例 + 三轮留痕 + E2E/回归套件
- tests/docgen/:DC-UNIT/API/CONF/E2E/UI/REGRESSION/PERF 分组用例与可复跑脚本,报告逐条留痕(R1-R3 全记录)
- 意图 30 条前后端同表双跑(pytest + node)
- Playwright headless:docgen-ui/docgen-regression spec + b3 benchpanel 第 5 TAB 断言更新

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-03 21:13:47 +08:00

75 lines
3.9 KiB
Bash
Executable File
Raw Permalink Blame History

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.
#!/usr/bin/env bash
# run_all.sh —— docgen P0 测试统一入口(测试 agent)
#
# 用法:
# bash tests/docgen/run_all.sh all # 全量(除需 TL 启动受控实例的组)
# bash tests/docgen/run_all.sh unit # DC-UNIT-*(pytest 验收口径,无外部依赖)
# bash tests/docgen/run_all.sh api # DC-API(TestClient + mock)
# bash tests/docgen/run_all.sh intent # DC-INTENT-CASES 30 条(后端 pytest + 前端 node 同表双跑)
# bash tests/docgen/run_all.sh conf # DC-CONF(含受控假远端,见 test_docgen_conf.py 头注释)
# bash tests/docgen/run_all.sh e2e # DC-E2E-CURL(需 TL 启动 dev BFF+vstore 并设 DOCGEN_E2E_BFF/DOCGEN_E2E_VSTORE)
# bash tests/docgen/run_all.sh perf # DC-PERF(需 TL 启动受控 vstore;导入工具 dev2 交付后可用)
# bash tests/docgen/run_all.sh failover # DC-FAILOVER(提示阅读 runbook;演练必须人工按 runbook 执行)
# bash tests/docgen/run_all.sh ui # DC-UI(提示浏览器核对清单路径)
# bash tests/docgen/run_all.sh regression # DC-REGRESSION(提示既有 Playwright 套件与人工核对)
#
# pytest 统一入口:-c tests/docgen/pytest.ini(markers 注册在本目录 pytest.ini,不碰仓库其他配置)
# 纪律:
# - 未经 TL 指令不执行任何测试;本脚本是执行入口不是授权
# - 不触碰生产端口 8090/8091/5180;受控实例端口由 TL 通过环境变量告知
# - 只读执行;不 commit、不 push;轮测结果由测试 agent 留痕回 test_case_report.md
# - 开发模块未交付时对应脚本以 SKIP/PENDING 输出,不视为 FAIL
set -u
cd "$(dirname "$0")/../.." || exit 2 # 切到仓库根
PY=/home/xzq/5090/teamWorkspace/zh/plantai-rag-new-venv/bin/python
pytest_run() { "$PY" -m pytest -c tests/docgen/pytest.ini "$@"; }
PASS=0; FAIL=0; SKIP=0
run() { # run <标签> <命令...>
local tag="$1"; shift
echo
echo "===== [$tag] ====="
"$@"
local rc=$?
if [ $rc -eq 0 ]; then PASS=$((PASS+1)); echo "[$tag] PASS";
elif [ $rc -eq 77 ]; then SKIP=$((SKIP+1)); echo "[$tag] SKIP/PENDING";
else FAIL=$((FAIL+1)); echo "[$tag] FAIL(rc=$rc)"; fi
}
case "${1:-all}" in
unit)
run unit pytest_run tests/docgen/test_unit_acceptance.py -q --no-header -m "not conf" ;;
api)
run api pytest_run tests/docgen/test_docgen_api_acceptance.py -q --no-header ;;
intent)
run intent-backend pytest_run tests/docgen/test_intent_cases.py -q --no-header
run intent-frontend node tests/docgen/test_intent_frontend.mjs ;;
conf)
run conf pytest_run tests/docgen/test_docgen_conf.py -q --no-header ;;
e2e)
run e2e bash tests/docgen/run_e2e_curl.sh ;;
perf)
run perf bash tests/docgen/run_perf_import.sh ;;
failover)
echo "DC-FAILOVER 为受控演练:请阅读并严格按 tests/docgen/run_failover.md 执行(需 TL 在场)。" ;;
ui)
echo "DC-UI 为浏览器核对清单:请打开 tests/docgen/run_ui_checklist.md 逐条核对并留痕。" ;;
regression)
echo "DC-REGRESSION:执行既有 Playwright 套件(tests/e2e/,npx playwright test)并按 tests/docgen/run_regression.md 人工核对三项。" ;;
all)
run unit pytest_run tests/docgen/test_unit_acceptance.py -q --no-header -m "not conf"
run api pytest_run tests/docgen/test_docgen_api_acceptance.py -q --no-header
run intent-backend pytest_run tests/docgen/test_intent_cases.py -q --no-header
run intent-frontend node tests/docgen/test_intent_frontend.mjs
run conf pytest_run tests/docgen/test_docgen_conf.py -q --no-header
echo "---- 以下组需 TL 受控实例/人工核对:e2e / perf / failover / ui / regression ----"
;;
*) echo "未知分组: $1(可选 all/unit/api/intent/conf/e2e/perf/failover/ui/regression)"; exit 2 ;;
esac
echo
echo "===== run_all 汇总:PASS=$PASS FAIL=$FAIL SKIP=$SKIP ====="
[ "$FAIL" -eq 0 ] || exit 1