Proj Gen Test logo

Proj Gen Test

Community
zhangloveyan
proj-gen-test

生成单元测试和集成测试代码。用于为Service层生成测试、为Controller层生成测试、提高测试覆盖率。

Overview

Publisherzhangloveyan
Repositorybackend-skill
Skill nameproj-gen-test
Stars
102
Forks
31
Bundled files
3
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 3 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by zhangloveyan on GitHub. Read the source before you install it.

Installation

Install the Proj Gen Test AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/zhangloveyan/backend-skill/tree/main/.claude/skills/proj-gen-test
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/zhangloveyan/backend-skill.git /tmp/backend-skill
mkdir -p .claude/skills
cp -r /tmp/backend-skill/.claude/skills/proj-gen-test .claude/skills/proj-gen-test
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Proj Gen Test in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Proj Gen Test on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Proj Gen Test is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

生成测试代码

适用场景

  • 为 Service 层生成单元测试
  • 为 Controller 层生成单元测试
  • 为完整流程生成集成测试
  • 提高测试覆盖率

测试类型选择

类型场景特点
单元测试测试单个方法逻辑快速、Mock 依赖
集成测试测试完整流程真实数据库、慢

建议: 核心业务逻辑用单元测试,关键流程用集成测试。


测试框架

框架用途
JUnit 5测试框架
MockitoMock 框架
AssertJ断言库
SpringBootTest集成测试

前置检查

生成测试前,先确认任务文档:

  • 全流程任务文档存在
  • “代码审查”已完成
  • 将“生成测试”状态标记为进行中

生成测试前,检查目标模块的 pom.xml 是否包含测试依赖:

xml
<dependency>
    <groupId>org.mockito</groupId>
    <artifactId>mockito-junit-jupiter</artifactId>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter</artifactId>
    <scope>test</scope>
</dependency>

如缺失,自动添加到 pom.xml 的 <dependencies> 中,然后再生成测试代码。


测试模板


测试命名规范

方法名_场景_预期结果

示例:
- create_Success
- create_DuplicateName_ThrowException
- getDetail_Found
- getDetail_NotFound_ThrowException
- update_Success
- delete_NotFound_ThrowException

测试原则

  1. 单一职责 - 每个测试只测一个场景
  2. 独立性 - 测试之间互不依赖
  3. 可重复 - 多次运行结果一致
  4. 自验证 - 测试自动判断通过/失败
  5. 及时性 - 与代码同步编写

测试覆盖要求

层级覆盖要求
Service核心业务逻辑 100%
Controller主要接口 80%
Utils工具方法 100%

同步任务文档

  • 产物清单记录测试代码路径或测试报告路径
  • 流程状态总览标记“生成测试”为已完成
  • 更新下一步指令为“运行测试并记录结果”

注意事项

  1. Mock 外部依赖 - 数据库、Redis、第三方接口
  2. 测试边界条件 - null、空集合、边界值
  3. 测试异常场景 - 业务异常、系统异常
  4. 保持测试简洁 - 避免测试代码过于复杂

相关模板

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Proj Gen Test AI skill do?

生成单元测试和集成测试代码。用于为Service层生成测试、为Controller层生成测试、提高测试覆盖率。

Why use Proj Gen Test on TypingMind?

Because you install it once and use it with any model. Proj Gen Test is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Proj Gen Test in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/zhangloveyan/backend-skill/tree/main/.claude/skills/proj-gen-test. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Proj Gen Test?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Proj Gen Test?

As many as you like. As long as a model supports skills, you can use Proj Gen Test with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Proj Gen Test AI skill free?

Yes. It is published on GitHub by zhangloveyan under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇