unit-test-generator

Solid

Automatically generate unit tests based on source code, supporting multiple languages and testing frameworks.

Testing & QA 542 stars 70 forks Updated 6 days ago CC0-1.0

Install

View on GitHub

Quality Score: 91/100

Stars 20%
91
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Unit Test Generator > 根据源代码自动生成单元测试,支持多种语言和测试框架。 > > Automatically generate unit tests based on source code, supporting multiple languages and testing frameworks. ## When to Use 当用户请求以下操作时使用此 skill: - 生成单元测试 / Generate unit tests - 为函数/类编写测试 / Write tests for functions/classes - 创建测试用例 / Create test cases - 提高代码覆盖率 / Improve code coverage ## Instructions ### 分析步骤 / Analysis Steps 1. **识别代码** - 确定编程语言和代码结构 2. **分析功能** - 理解函数/方法的输入、输出和行为 3. **确定边界** - 识别边界条件和边缘情况 4. **选择框架** - 根据语言选择合适的测试框架 5. **生成测试** - 编写全面的测试用例 ### 支持的语言和框架 / Supported Languages | 语言 | 测试框架 | |------|----------| | Python | pytest, unittest | | JavaScript/TypeScript | Jest, Mocha, Vitest | | Java | JUnit, TestNG | | Go | testing (built-in) | | Rust | cargo test (built-in) | ### 测试类型 / Test Types - **正常路径测试** - 验证预期行为 - **边界条件测试** - 测试边界值 - **异常处理测试** - 验证错误处理 - **空值/空输入测试** - 处理空值情况 ### 输出格式 / Output Format 使用 `templates/test-report.md` 模板格式化输出。 Use the `templates/test-report.md` template to format output. ```markdown ## 单元测试生成报告 / Unit Test Generation Report ### 分析概述 / Analysis Summary [代码分析总结] ### 生成的测试 / Generated Tests [测试代码] ### 测试覆盖说明 / Coverage Notes - 覆盖的场景 - 建议补充的测试 ``` ## Examples ### 输入 / Input ```python def divide(a: float, b: float) -> float: if b == 0: raise ValueError("Cannot divide by zero") return a / b ``` ### 输出 / Output ## 单元测试生成报告 ### 分析概述 `divide` 函数执行除法运算,包含除零检查。需要测试正常除法、除零异常、边界值等情况。 ### 生成的测试 ```python import pytest from your_module import div...

Details

Author
JackyST0
Repository
JackyST0/awesome-agent-skills
Created
4 months ago
Last Updated
6 days ago
Language
Shell
License
CC0-1.0

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

Testing & QA Featured

unit-testing-test-generate

Generate comprehensive, maintainable unit tests across languages with strong coverage and edge case focus.

39,227 Updated today
sickn33
Testing & QA Listed

unit-testing-test-generate

Generate comprehensive, maintainable unit tests across languages with strong coverage and edge case focus.

335 Updated today
aiskillstore
Testing & QA Solid

generating-unit-tests

This skill enables Claude to automatically generate comprehensive unit tests from source code. It is triggered when the user requests unit tests, test cases, or test suites for specific files or code snippets. The skill supports multiple testing frameworks including Jest, pytest, JUnit, and others, intelligently detecting the appropriate framework or using one specified by the user. Use this skill when the user asks to "generate tests", "create unit tests", or uses the shortcut "gut" followed by a file path.

2,266 Updated today
jeremylongshore
Testing & QA Listed

test-generator

Generate unit tests based on existing code patterns and testing frameworks.

335 Updated today
aiskillstore
Testing & QA Solid

code-testing-agent

Generates comprehensive, workable unit tests for any programming language using a multi-agent pipeline. Use when asked to generate tests, write unit tests, improve test coverage, add test coverage, create test files, or test a codebase. Supports C#, TypeScript, JavaScript, Python, Go, Rust, Java, and more. Orchestrates research, planning, and implementation phases to produce tests that compile, pass, and follow project conventions.

3,196 Updated yesterday
dotnet