Guanghu Domestic Migration d1e47f4565
Some checks are pending
自动更新代码和重启 / update-and-restart (push) Waiting to run
CI检查 + 自动部署 / check (push) Waiting to run
CI检查 + 自动部署 / deploy (push) Blocked by required conditions
重启聊天服务 / restart (push) Waiting to run
chore: import sanitized domestic snapshot for REPO-002
Source snapshot: ca48d3ddf926d79aa138306164169baf764bb829
2026-07-17 15:54:41 +08:00

35 lines
1.0 KiB
Markdown
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.

# GMP-Agent 测试套件
## 运行测试
```bash
# 运行全部测试使用test-runner
node gmp-agent/src/test-runner.js --verbose
# 运行单个测试
node gmp-agent/test/test-logger.js
node gmp-agent/test/test-runner-self.js
node gmp-agent/test/test-health.js
```
## 测试文件说明
| 文件 | 测试对象 | 说明 |
|------|----------|------|
| test-logger.js | src/logger.js | 日志收集模块自测:实例化、写入、查询、统计、轮转 |
| test-runner-self.js | src/test-runner.js | 测试运行器自测发现、报告生成、verdict逻辑 |
| test-health.js | GMP-Agent环境 | 健康检查Node版本、标准库、文件系统、目录结构 |
## 测试报告
运行 test-runner 后会在 `gmp-agent/test-report.json` 生成结构化测试报告。
## 编写新测试
1. 文件名必须以 `test-` 开头,以 `.js` 结尾
2. 测试通过时 `process.exit(0)`,失败时 `process.exit(1)`
3. 测试运行器会自动发现并执行
---
*GH-GMP-004 · 录册A02 · 2026-04-26*