ai-generated-ut-code-review
AI UT Code Review
Overview
Review AI-generated unit tests for effectiveness, coverage, assertions, negative cases, determinism, and maintainability. Output a 0-10 score, a risk level, and a must-fix checklist. Overall line coverage must be >= 80%; otherwise risk is at least High.
When to Use
- AI-generated UT/test code review or quality evaluation
- Need scoring, risk level, or must-fix checklist
- Questions about coverage or assertion validity
Workflow
- Confirm tests target the intended business code and key paths.
- Check overall line coverage (>= 80% required).
- Inspect assertions for behavioral validity; flag missing/ineffective assertions.
- Verify negative/edge cases and determinism (no env/time dependency).
- Score by rubric, assign risk, list must-fix items with evidence.
Scoring (0-10)
Each dimension 0-2 points. Sum = total score.
| Dimension | 0 | 1 | 2 |
|---|---|---|---|
| Coverage | < 80% | 80%+ but shallow | 80%+ and meaningful |
| Assertion Quality | No/invalid assertions | Some weak assertions | Behavior-anchored assertions |
| Negative & Edge | Missing | Partial | Comprehensive |
| Data & Isolation | Flaky/env-dependent | Mixed | Deterministic, isolated |
| Maintainability | Hard to read/modify | Mixed quality | Clear structure & naming |
Risk Levels
- Blocker: Coverage < 80% AND key paths untested, or tests have no meaningful assertions
- High: Coverage < 80% OR assertions largely ineffective
- Medium: Coverage OK but weak edge cases or fragile design
- Low: Minor improvements
Must-Fix Checklist
- Overall line coverage >= 80%
- Each test has at least one behavior-relevant assertion
- Negative/exception cases exist for core logic
- Tests are deterministic and repeatable
AI-Generated Test Pitfalls (Check Explicitly)
- No assertions or assertions unrelated to behavior (e.g., only not-null)
- Over-mocking hides real behavior
- Only happy-path coverage
- Tests depend on time/network/env
- Missing verification of side effects
Output Format (Required, Semi-fixed)
Score: x/10 — Coverage x, Assertion Quality x, Negative & Edge x, Data & Isolation x, Maintainability xRisk: Low/Medium/High/Blocker — 简述原因(1 行)Must-fix:- [动作 + 证据]
- [动作 + 证据]
Key Evidence:- 引用具体测试用例名或覆盖率报告摘要(1-2 条)
Notes:- 最小修复建议或替代方案(1-2 行)
Rules:
- 覆盖率 < 80% 风险至少 High,并必须列入
Must-fix - 无断言/无效断言直接提升风险级别,必须列入
Must-fix - 至少 2 条证据;证据不足需说明并降分
Common Mistakes
- 仅报告覆盖率,不评价断言有效性
- 把日志输出当成断言
- 忽略失败路径/异常路径
Example (Concise)
Score: 5/10 (Coverage 1, Assertion 0, Negative 1, Data 2, Maintainability 1) Risk: High Must-fix:
- Tests for
parseConfig()contain no behavior assertions (only logs) - No negative cases for malformed input Key Evidence:
parseConfig()tests only assert no crash- Coverage report shows 62% lines Notes:
- Add assertions on outputs and side effects; add invalid input tests.
More from openharmonyinsight/openharmony-skills
ohos-chromium-security-review
|
55ai-generated-business-code-review
Use when reviewing or scoring AI-generated business/application code quality in any language, especially when a numeric score, risk level, or must-fix checklist is requested, or when C++ code must comply with OpenHarmony C++ and security standards
53openharmony-download
Interactive OpenHarmony source code download with mirror selection (GitCode/Gitee/GitHub), environment checking, branch selection, and real-time progress. Use when user requests:"下载 OpenHarmony", "download OpenHarmony", "下载源码", "获取源码", "拉取代码", "clone openharmony", or "repo init".
53compile-analysis
This skill should be used when the user asks to "分析编译效率", "分析编译时间", "查看头文件依赖", "保存编译命令", "提取编译命令", "生成编译脚本", "保存这个文件的编译命令", "单独编译这个文件", "编译单个文件", "单编文件", "独立编译文件", "分析这个文件的头文件依赖", "头文件依赖关系", "这个文件依赖了多少头文件", "analyze compilation", "check header dependencies", "分析文件编译开销", "save compile command", "extract compile command", "generate compile script", "compile single file", "compile individual file", "standalone compile", "analyze header dependencies", "header dependency tree", "how many header files", or mentions analyzing compilation performance, build times, include dependencies, extracting/saving compilation commands, generating standalone compilation scripts, compiling individual files in isolation, or analyzing header file dependency relationships for specific source files in the ace_engine project. Provides comprehensive compilation efficiency analysis including timing, resource usage, dependency tree visualization with automatic saving, the ability to save reusable compilation scripts with performance monitoring, and standalone compilation capabilities using generated scripts.
49code-checker
Scan C/C++ codebases for code quality issues including extra large files/functions and circular dependencies. Use when the user asks to check file sizes, find oversized functions, detect circular dependencies, analyze code complexity, find code smells, or identify maintainability issues in C/C++ code. Supports scanning individual files or entire directories with configurable thresholds.
46oh-distributed-security-design-review
OpenHarmony分布式系统安全代码检视专用技能。当用户要求"检视代码安全实现"、"代码安全审查"、"安全代码review"或类似的分布式系统代码安全检视请求时触发。此技能提供18条OpenHarmony分布式业务安全设计规则的详细检视指导,涵盖授权控制、状态机、数据传输、权限管理、可信关系等安全领域。使用此技能可在通用网络安全规则基础上,针对OpenHarmony分布式系统进行专项安全检视。
42