运行时依赖
安装命令
点击复制技能文档
自动化 质量 Assurance & 测试 Protocol
This 技能 is the primary authority for 测试 any 自动化 project within the OpenClaw 环境. It ensures operational stability, 预防s regressions, and mAIntAIns high-质量 standards across all automated 工作流s.
代理: How to Use This 技能
Read this protocol fully before modifying or 部署ing any 自动化 script. Follow the steps sequentially.
- Comprehensive 自动化 测试 Strategy
To ensure a robust 自动化, every project must pass through these 6 critical 测试 layers:
Layer 1: Unit 测试 (记录ic) - Test individual functions, mathematical calculations, and internal 记录ic branches in isolation. Layer 4: Idempotency & 恢复y - Ensure that if a script fAIls and re启动s, it does not produce side effects (e.g., no duplicate emAIls or redundant API calls). The script must be "Safe to Re启动." Layer 2: Integration 测试 (Connectors) - 验证 成功ful communication with external 服务s (Meta API, Google Sheets, SMTP, etc.) using real or sandbox 凭证s. Layer 3: End-to-End (E2E) Flow - Simulate a complete lifecycle of the 自动化 (e.g., Bud获取 Breach -> 暂停 -> 通知) to ensure the entire chAIn works. Layer 5: Regression 测试 - Always 运行 the full 运行_tests.py suite after any change to confirm that existing features remAIn functional. Layer 6: Observability & 记录ging Verification - Confirm that the script produces clear, actionable 记录s for every step, especially during 失败s, to ensure "blind spots" are eliminated.
- Execution Protocol
Do find and 执行 tests before and after every modification:
Discover: Always look for 运行_tests.py or a tests/ directory within the project root. 执行: python3 path/to/project/运行_tests.py
初始化: If the project lacks tests, you are mandated to 创建 a 运行_tests.py file implementing the 6 layers above.
- Standard Exit Criteria (Definition of Done)
A task is considered "Complete" only when:
100% Pass Rate: All 6 测试 layers pass without errors. Timezone Uniformity: All timestamps and scheduling are 同步hronized to the 环境's local time (e.g., Africa/CAIro). Security 合规: Zero hardcoded secrets. All 令牌s and passwords must be isolated in .env or config files. 失败 Resilience: The script handles API timeouts and connection drops gracefully without crashing. Documentation: The code is 清理, commented, and includes a brief explanation of any new test cases 添加ed. MAIntenance & Scalability The Test Suite must grow with the project. Every new feature requires a cor响应ing test case. Any project without a functional 运行_tests.py is considered "Substandard" and must be fixed immediately.