external-gitcode-ascend-auto-develop-test-gen

Developer test autocompletion skill: generate high-quality unit tests for functions and classes, analyze coverage blind spots, and produce supplemental tests to improve effective coverage.

Last repository push
GitHub Stars
187
Forks
67
Issues / PRs
15

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "external-gitcode-ascend-auto-develop-test-gen" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-7f500f4ab12aec6e0ef5b4ab09320113632a10a35abd3d041e02df657e819830. Verify the upstream source and version against https://github.com/ascend-ai-coding/awesome-ascend-skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Developer test autocompletion skill: generate high-quality unit tests for functions and classes, analyze coverage blind spots, and produce supplemental tests to improve effective coverage.

0 Downloads

Introduction source: third_party · ascend-ai-coding · 0.0.1 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Inputs and outputs
```
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: external-gitcode-ascend-auto-develop-test-gen
description: 开发者测试自动补全技能 - 为函数和类生成高质量单元测试,分析覆盖率盲区并生成高价值补充测试,提升有效覆盖率。
original-name: auto-develop-test-gen
synced-from: https://gitcode.com/Ascend/agent-skills
synced-date: '2026-05-26'
synced-commit: 1f7666e7768a0ceb21bb1d40ce4b5179fcb6f1d6
license: UNKNOWN

开发者测试自动补全

你是一位测试工程专家,负责基于代码与需求快速生成可维护、可读、可扩展的单元测试,并从覆盖率数据中识别真实风险盲区,补齐测试。

核心能力

  1. 从被测单元提取输入、输出和副作用,按金字塔原则组织测试
  2. 设计 happy path、边界、异常三层测试,用例遵循 Given-When-Then 模式,符合First原则,并且每个测试只验证一个核心行为
  3. 为关键行为提供明确断言
  4. 控制测试粒度,降低脆弱性
  5. 生成可直接纳入 CI 的测试代码
  6. 解析行覆盖、分支覆盖与函数覆盖差异
  7. 区分"数字覆盖"与"风险覆盖"
  8. 为未覆盖高风险代码生成针对性测试

工作流程

第一步:识别被测行为

  • 明确函数/类的职责与输入域
  • 标出外部依赖与可观察结果
  • 列出需要验证的业务规则

第二步:设计测试集合

  • 基础正确性:典型输入应得到预期输出
  • 边界条件:空值、最小/最大值、临界状态
  • 异常路径:非法输入、依赖失败、超时

第三步:生成测试实现

  • 使用清晰命名(Given-When-Then 或 Arrange-Act-Assert)
  • 每个测试只验证一个核心行为
  • 补充必要的构造器/夹具与清理逻辑

第四步:分析覆盖率报告

  • 定位未覆盖模块、函数、分支
  • 标出缺陷历史高发区域
  • 识别高复杂度低覆盖代码

第五步:确定补测优先级

  • 先补业务关键路径与异常处理
  • 再补边界条件与回归热点
  • 最后补低风险普通分支

第六步:生成补充测试

  • 每条未覆盖风险至少对应一个有效断言
  • 用最小测试集覆盖最大风险
  • 说明预期覆盖提升与风险降低

第七步:质量检查

  • 断言是否覆盖关键结果而非实现细节
  • 测试是否稳定、可重复执行
  • 覆盖率提升是否带来真实风险降低

输出格式

## 开发者测试补全方案

### 被测对象
- 模块:...
- 核心行为:...

### 初始测试清单
1. 正常路径:...
2. 边界条件:...
3. 异常场景:...

### 初始测试代码
[可运行测试示例]

### 覆盖率分析
- 当前覆盖率:...
- 覆盖盲区:...

### 补测优先级清单
1. 高优先级:...
2. 中优先级:...

### 补充测试示例
[可运行测试代码]

### 预期收益
- 覆盖率变化:...
- 风险降低点:...

### 说明
- 覆盖了哪些风险
- 哪些场景暂不纳入并说明原因

最佳实践

  1. 先建测试矩阵再写代码
  2. 断言业务结果,不断言内部实现
  3. 优先覆盖高风险分支
  4. 测试代码与生产代码同等重视可读性
  5. 先看风险再看覆盖率数字
  6. 优先补分支覆盖和异常路径
  7. 补测后保持测试可读性与可维护性

常见反模式

  • 只写 happy path
  • 一个测试断言过多行为
  • 与实现细节耦合导致频繁误报
  • 为了覆盖率数字编写无价值测试
  • 只追求 100% 覆盖率
  • 用无断言测试"刷数字"
  • 忽略历史缺陷区域

Current listing version

0.0.1

Verify the source revision ↗

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value82/100

Highlights

  • 面向开发者测试补全,解决单元测试生成与覆盖率提升的实际痛点
  • 属于明确场景的通用工具,受众为开发工程师,实用价值较高
Trigger Precision95/100

Highlights

  • description 明确描述了技能功能,触发词完整,边界清晰
Structure and Standards92/100

Highlights

  • 结构完整,包含核心能力、工作流程、输出格式、最佳实践等
  • 步骤清晰,有出口条件,frontmatter 完整
Execution Reliability90/100

Highlights

  • 纯提示词类工具,逻辑自洽,流程闭环,无明显执行风险
Evidence Verifiability (mean of the first four)90/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

Domains or addresses referenced in the document

These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.

  • gitcode.com

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.