在 Manus 中运行任何 Skill
一键导入
一键导入
一键在 Manus 中运行任何 Skill
开始使用test-generator
星标568
分支51
更新时间2026年4月18日 02:04
自动生成单元测试:识别函数逻辑、覆盖边界条件、生成可运行测试代码
安装
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
SKILL.md
readonly菜单
自动生成单元测试:识别函数逻辑、覆盖边界条件、生成可运行测试代码
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
API 自动化测试 - OpenAPI 解析、测试用例生成、集成测试
Changelog 生成器 - 从 Git 历史自动生成 CHANGELOG
数据库迁移助手 - Schema 对比、迁移脚本生成
Git 工作流自动化 - 智能分支管理、提交信息生成、PR 创建
重构顾问 - 识别代码坏味道并提供重构方案
中文 README 生成器 - 先分析项目,再生成面向中文开发者的高质量 README
| name | test-generator |
| description | 自动生成单元测试:识别函数逻辑、覆盖边界条件、生成可运行测试代码 |
当用户要求"生成测试"、"写单元测试"、"为 XX 函数写测试"、"增加测试覆盖率"时激活此技能。
每个函数至少覆盖:
根据项目语言和测试框架生成对应代码:
import pytest
from mymodule import my_function
class TestMyFunction:
def test_normal_input(self):
assert my_function("hello") == "HELLO"
def test_empty_string(self):
assert my_function("") == ""
def test_none_input(self):
with pytest.raises(TypeError):
my_function(None)
def test_special_characters(self):
assert my_function("你好!@#") == "你好!@#"
const { myFunction } = require('./mymodule');
describe('myFunction', () => {
test('正常输入', () => {
expect(myFunction('hello')).toBe('HELLO');
});
test('空字符串', () => {
expect(myFunction('')).toBe('');
});
test('null 输入', () => {
expect(() => myFunction(null)).toThrow(TypeError);
});
});
package mypackage
import "testing"
func TestMyFunction(t *testing.T) {
tests := []struct {
name string
input string
want string
}{
{"正常输入", "hello", "HELLO"},
{"空字符串", "", ""},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := MyFunction(tt.input); got != tt.want {
t.Errorf("MyFunction(%q) = %q, want %q", tt.input, got, tt.want)
}
})
}
}
test_函数名_场景描述 或 函数名_正常输入/边界条件/异常输入