unit-test-generator
Unit test generator that produces comprehensive test suites across multiple programming languages.
- CCM score
- 49 of 100
- version
- 1.0.0
- GitHub stars
- 38
Own this plugin? Claim it
What it does
- Generates unit tests for several programming languages from source code in your project
- Covers comprehensive test case generation, with the specific languages and commands not described in the source
- Designed for developers who want automated unit test scaffolding across mixed-language codebases
Generate comprehensive unit tests for multiple languages
Add marketplace
/plugin marketplace add glincker/claude-code-marketplaceRun it inside Claude Code once, then install the plugin below.
Install
/plugin install unit-test-generator@glincker-marketplaceRun it inside Claude Code after adding the marketplace.
Files
Discovered from sourceUnit Test Generator
Automatically generates comprehensive unit tests for your code, supporting multiple programming languages and testing frameworks.
What This Skill Does
This skill creates high-quality unit tests by:
- Analyzing function/method signatures and logic
- Generating test cases for happy paths
- Creating edge case tests
- Adding error condition tests
- Following language-specific best practices
- Using appropriate testing frameworks
- Including setup/teardown when needed
Instructions
1. Code Analysis
When asked to generate tests:
-
Identify target code:
- Use Read to examine the source file
- Parse function/class signatures
- Understand parameters, return types, and dependencies
-
Detect language and framework:
- Python: pytest, unittest
- JavaScript/TypeScript: Jest, Mocha, Vitest
- Go: testing package
- Rust: built-in test framework
- Java: JUnit
-
Analyze logic:
- Identify all code paths
- Find conditionals and branches
- Locate error handling
- Determine edge cases
2. Test Generation Strategy
Create tests covering:
Happy Path Tests:
- Normal input → expected output
- Valid use cases
- Common scenarios
Edge Cases:
- Empty inputs
- Boundary values (min, max)
- Special characters
- Large datasets
- Zero/null values
Error Conditions:
- Invalid inputs
- Type mismatches
- Missing required parameters
- Exception scenarios
Integration Points:
- Mock external dependencies
- Stub API calls
- Fake database interactions
3. Test Structure
Follow framework-specific conventions:
Python (pytest):
import pytest
from module import function_to_test
class TestFunctionName:
def test_happy_path(self):
# Arrange
input_data = "valid input"
# Act
result = function_to_test(input_data)
# Assert
assert result == expected_value
def test_edge_case_empty_input(self):
with pytest.raises(ValueError):
function_to_test("")
JavaScript (Jest):
describe('functionName', () => {
test('should handle valid input', () => {
// Arrange
const input = 'test';
// Act
const result = functionName(input);
// Assert
expect(result).toBe(expected);
});
test('should throw error on invalid input', () => {
expect(() => functionName(null)).toThrow();
});
});
4. Test Quality
Ensure generated tests:
- Have descriptive names (test_should_do_x_when_y)
- Follow AAA pattern (Arrange, Act, Assert)
- Are independent and isolated
- Run deterministically
- Have clear assertions
- Include comments explaining complex scenarios
5. Output
Present the generated tests and:
- Explain coverage achieved
- Note any uncovered scenarios
- Suggest where to place test file
- Offer to write tests to appropriate test directory
Examples
Example 1: Python Function
User Request: "Generate tests for the calculate_discount function"
Source Code:
def calculate_discount(price: float, discount_percent: int) -> float:
if discount_percent < 0 or discount_percent > 100:
raise ValueError("Discount must be between 0 and 100")
return price * (1 - discount_percent / 100)
Generated Tests:
import pytest
from shopping import calculate_discount
class TestCalculateDiscount:
def test_valid_discount(self):
"""Test normal discount calculation"""
result = calculate_discount(100.0, 20)
assert result == 80.0
def test_zero_discount(self):
"""Test with no discount"""
result = calculate_discount(100.0, 0)
assert result == 100.0
def test_full_discount(self):
"""Test with 100% discount"""
result = calculate_discount(100.0, 100)
assert result == 0.0
def test_negative_discount_raises_error(self):
"""Test that negative discount raises ValueError"""
with pytest.raises(ValueError, match="between 0 and 100"):
calculate_discount(100.0, -10)
def test_discount_over_100_raises_error(self):
"""Test that discount > 100 raises ValueError"""
with pytest.raises(ValueError, match="between 0 and 100"):
calculate_discount(100.0, 150)
def test_zero_price(self):
"""Test with price of 0"""
result = calculate_discount(0.0, 50)
assert result == 0.0
Example 2: JavaScript Class
User Request: "Create unit tests for the UserValidator class"
Generated Approach:
- Read the class definition
- Identify all methods
- Generate tests for each method
- Mock dependencies (if any)
- Create comprehensive test suite
Tool Requirements
- Read: Examine source code files
- Grep: Find existing tests, check coverage
- Write: Create test files
- Bash: Run tests to verify they work (optional)
Limitations
- Cannot test private implementation details (by design)
- May not cover all business logic edge cases without context
- Generated tests should be reviewed and customized
- Cannot generate integration/E2E tests (use specific skills for those)
- Works best with pure functions and well-structured code
Best Practices
When using this skill:
- Start with one function: Don't try to test entire file at once
- Review generated tests: Ensure they make sense for your use case
- Add domain knowledge: Include business-specific edge cases
- Run the tests: Verify they pass before committing
- Maintain test quality: Keep tests updated as code changes
Error Handling
- Complex code: Break down into smaller testable units first
- Heavy dependencies: Suggest refactoring for testability
- No clear test path: Ask user for expected behavior
- Existing tests found: Offer to extend rather than replace
Configuration
Adapts to detected setup:
| Language | Framework | Test File Location |
|---|---|---|
| Python | pytest | tests/test_*.py |
| Python | unittest | tests/test_*.py |
| JavaScript | Jest | __tests__/*.test.js |
| TypeScript | Jest | __tests__/*.test.ts |
| Go | testing | *_test.go (same dir) |
| Rust | built-in | tests/ or inline |
Related Skills
- tdd-workflow - Test-driven development process
- coverage-analyzer - Analyze test coverage
- test-refactorer - Improve existing tests
Changelog
Version 1.0.0 (2025-01-13)
- Initial release
- Support for Python, JavaScript, TypeScript
- pytest and Jest framework support
- AAA pattern enforcement
- Edge case generation
Contributing
Want to add support for a new language or framework?
- Open an issue with the language/framework name
- Submit a PR with examples
- Follow Contributing Guidelines
License
Apache License 2.0 - See LICENSE
Author
GLINCKER Team
- GitHub: @GLINCKER
- Repository: claude-code-marketplace
From the glincker/claude-code-marketplace README
GLINCKER Claude Code Marketplace
Community-Driven Agent Marketplace - A comprehensive collection of specialized agents, automation workflows, and developer productivity tools
What GLINCKER Offers
A comprehensive marketplace of production-ready agents and tools designed to solve real developer pain points. Built by the community, for the community.
| Category | What We Provide | How It Helps |
|---|---|---|
| Multi-Agent Coordination | 5 parallel agents for code review | Comprehensive analysis from security, performance, testing, architecture, and style perspectives |
| Workflow Orchestration | YAML-based agent chaining | Automate complex pipelines with conditional logic and parallel execution |
| Quick Access | 7 slash commands | Instant access to common development tasks |
| Integrations | Database queries + 100+ APIs | Natural language interface to your entire stack |
| Infrastructure | Docker, Kubernetes, CI/CD | Production-ready configurations and best practices |
| Full SDLC Coverage | 23+ specialized agents | End-to-end support from development to deployment |
Why Choose GLINCKER
Comprehensive: 23+ specialized agents covering every stage of development Collaborative: Multi-agent coordination for complex tasks Automated: Workflow orchestration to chain agents together Production-Ready: Battle-tested configurations and best practices Open Source: Community-driven with transparent development Extensible: Easy to add your own agents and workflows
We're always improving - contributions welcome! See our Contributing Guide to help make this marketplace even better.
Architecture
Multi-Agent Code Review System
graph TD
A[Pull Request] --> B[PR Reviewer Skill]
B --> C[Security Agent]
B --> D[Performance Agent]
B --> E[Testing Agent]
B --> F[Architecture Agent]
B --> G[Style Agent]
C --> H[Synthesizer]
D --> H
E --> H
F --> H
G --> H
H --> I[Comprehensive Review Report]
I --> J[Auto-Generated Fixes]
Workflow Composition Framework
┌─────────────────────────────────────────────────────────────┐
│ Workflow Composer │
├─────────────────────────────────────────────────────────────┤
│ │
│ Step 1: Code Quality Checks (Parallel) │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Linter │ │ Security │ │ Tests │ │
│ └────┬─────┘ └────┬─────┘ └────┬─────┘ │
│ └─────────────┼─────────────┘ │
│ ↓ │
│ Step 2: Conditional Logic │
│ ┌─────────────────────────────────────┐ │
│ │ IF all_passed THEN proceed │ │
│ │ ELSE notify and exit │ │
│ └────────────────┬────────────────────┘ │
│ ↓ │
│ Step 3: Deployment │
│ ┌─────────────────────────────────────┐ │
│ │ Deploy with retry (max 3 attempts) │ │
│ └─────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘
Quick Start
1. Install Marketplace
/plugin marketplace add https://github.com/GLINCKER/claude-code-marketplace
2. Install Essential Agents
# Core development agents
/plugin install pr-reviewer@glincker-marketplace
/plugin install security-scanner@glincker-marketplace
/plugin install docker-wizard@glincker-marketplace
# Or install all
/plugin marketplace install glincker-marketplace
3. Use Slash Commands
/review # Multi-agent code review (5 agents)
/test # Generate unit tests
/security-scan # OWASP Top 10 audit
/docker-setup # Generate Docker config
/k8s-setup # Generate Kubernetes manifests
/deploy staging # Orchestrated deployment
/workflow # Create automated workflow
4. Natural Language Commands
# Database queries
"Show me users who signed up last month with revenue > $100"
# API integrations
"Send Slack message to #engineering: Deployment complete"
# Code migration
"Migrate this React component from class to hooks"
# Infrastructure
"Generate production-ready K8s manifests with autoscaling"
# Workflows
"Create workflow: test → security scan → deploy if all pass"
Featured Skills
Autonomous PR Reviewer
Location: skills/devops/pr-reviewer/
Multi-agent code review system with 5 specialized agents working in parallel.
- Security Agent: Vulnerability scanning, OWASP compliance
- Performance Agent: Bottleneck detection, optimization suggestions
- Testing Agent: Coverage analysis, test case generation
- Architecture Agent: Design pattern review, SOLID principles
- Style Agent: Code style, documentation quality
Unique value: 5x more thorough than single-agent reviews, generates actionable fixes.
Workflow Composer
Location: skills/automation/workflow-composer/
First skill composition framework for Claude Code. Chain multiple skills with YAML configuration.
steps:
- name: quality-checks
parallel:
- skill: security-scan
- skill: test-runner
- skill: linter
- name: deploy
when: ${steps.quality-checks.all_passed}
skill: deploy-orchestrator
retry:
max_attempts: 3
backoff: exponential
Unique value: Build complex automation pipelines without coding.
Database Query (Natural Language)
Location: skills/integrations/database-query/
Query any database using natural language with automatic optimization.
-- Input: "Show me users who signed up last month"
-- Generated:
SELECT * FROM users
WHERE created_at >= NOW() - INTERVAL '1 month'
ORDER BY created_at DESC;
-- Includes: Query optimization, index suggestions, EXPLAIN ANALYZE
Supported: PostgreSQL, MySQL, MongoDB, SQLite, Redis
Unique value: Only skill with query optimization and index suggestions.
Code Migrator
Location: skills/development/code-migrator/
Automated legacy code modernization with risk assessment.
Supported migrations:
- Python 2 to Python 3
- JavaScript to TypeScript
- React Classes to Hooks
- Callbacks to Async/Await
- Framework upgrades (Django, Rails, Express)
Unique value: AI-powered risk assessment + automated test generation.
API Connector
Location: skills/integrations/api-connector/
Natural language interface to 100+ popular APIs.
Supported services:
- Development: GitHub, GitLab, Linear, Jira
- Communication: Slack, Discord, Twilio
- Payments: Stripe, PayPal, Square
- Cloud: AWS, Google Cloud, Azure
- AI: OpenAI, Anthropic, Hugging Face
- And 90+ more
Unique value: Handles authentication (OAuth, JWT), generates integration code.
Essential Skills
- README Generator (
skills/documentation/readme-generator/): Analyze project structure and generate comprehensive documentation - Unit Test Generator (
skills/testing/unit-test-generator/): Create tests for multiple languages with coverage analysis
Comparison
| Feature | GLINCKER | Other Marketplaces |
|---|---|---|
| Multi-Agent Skills | 5 parallel agents | None |
| Workflow Orchestration | YAML-based | None |
| API Integrations | 100+ services | Few (5-10) |
| Database Query | With optimization | Basic/None |
| Code Migration | AI + risk assessment | None |
| Code Generation | Multi-language | Limited |
Use Cases
Startup: "Set up CI/CD, generate tests, create documentation" → Automated workflow handles everything
Enterprise: "Migrate Python 2 monolith to Python 3 microservices" → Risk-assessed migration with automated testing
Developer: "Review code, optimize, and deploy" → Multi-agent review with automated deployment
Skill Categories
skills/
├── development/ # Code migration, refactoring, architecture
├── devops/ # PR review, CI/CD, deployment
├── testing/ # Unit tests, integration tests, coverage
├── documentation/ # README, API docs, changelogs
├── integrations/ # APIs, databases, external services
├── automation/ # Workflows, task automation
├── data-science/ # Data analysis, visualization
└── security/ # Audits, vulnerability scanning
Skill Structure
skills/category/your-skill/
├── SKILL.md # Required: Skill definition with YAML frontmatter
├── scripts/ # Optional: Helper scripts
└── templates/ # Optional: File templates
Minimal SKILL.md
---
name: your-skill
description: What your skill does
allowed-tools: ["Read", "Write"]
version: 1.0.0
author: Your Name
---
# Instructions
Clear instructions for Claude on executing this skill.
## Examples
Concrete usage examples.
Contributing
- Fork repository
- Create skill in appropriate category
- Follow Skill Template
- Submit pull request
- Pass community review
Resources:
- Contributing Guide - Detailed instructions
- Quick Start - Fast-track guide
- Unique Features - What makes us different
Quality Standards
All skills must have:
- Clear documentation with examples
- Minimal tool permissions (principle of least privilege)
- Security-conscious implementation
- Error handling for edge cases
- Automated testing where applicable
Safety
Skills execute code on your system. Before installing:
- Review source code
- Check author reputation
- Understand required permissions
- Only install from trusted sources
Community
- Discussions: Ask questions, share workflows
- Issues: Report bugs, request features
- Contributing: Contribution guidelines
Resources
License
Apache License 2.0 - See LICENSE
Acknowledgments
Built on:
- Anthropic's Skills - Foundation
- Claude Code community - Inspiration
- Open source contributors - Innovation
Made with Claude Code by the GLINCKER community
Details
- Marketplace
- glincker/claude-code-marketplace
- Source
- skills/testing/unit-test-generator
- Category
- Community
- Keywords
- testing, unit-tests, tdd
- Listed since
- Apr 7, 2026
Questions
What does the unit-test-generator plugin do?
The unit-test-generator skill reads your source files and writes unit tests for their functions and classes in several languages. It covers happy paths, edge cases, and error conditions, and it uses frameworks such as pytest, Jest, Go's testing package, Rust's built-in tests, and JUnit.
How do I install the unit-test-generator plugin in Claude Code?
Run /plugin marketplace add glincker/claude-code-marketplace, then run /plugin install unit-test-generator@glincker-marketplace inside Claude Code. The plugin then adds the unit-test-generator skill to your session.
Which tools does the unit-test-generator skill use?
The skill is allowed to use Read, Grep, Write and Bash. It reads your code, checks existing tests, writes new test files, and can run them to confirm they work.
Where does the unit-test-generator plugin stand in the Testing & QA category?
It is listed in the Testing & QA category on Claude Marketplaces, alongside agentic-qe-fleet, ruflo-testgen and webapp-testing. Its focus is on generating unit tests rather than integration or end-to-end tests, which its limitations section says it does not produce.
More from glincker/claude-code-marketplace
All 24- workflow-composerv1.0.0
- aident-skillv0.4.0
- api-connectorv1.0.0
- backend-architectv1.0.0
- changelog-generatorv1.0.0
- cicd-pipeline-builderv1.0.0
- code-migratorv1.0.0
- data-engineerv1.0.0
- database-queryv1.0.0
- deployment-managerv1.0.0
- devops-specialistv1.0.0
- docker-wizardv1.0.0
- environment-managerv1.0.0
- frontend-specialistv1.0.0
- git-hooks-managerv1.0.0
- hello-worldv1.0.0
- k8s-generatorv1.0.0
- performance-optimizerv1.0.0
- pr-reviewerv1.0.0
- qa-engineerv1.0.0
- readme-generatorv1.0.0
- security-scannerv1.0.0
- tech-writerv1.0.0
Similar to unit-test-generator
More Testing & QAunit-testingwshobson/agents42.9K starsUnit and integration test automation for Python and JavaScript with debugging support
test-writerrohitg00/awesome-claude-code-toolkit2.9K starsGenerate comprehensive unit and integration tests with full coverage
engineering-testingmarslanalvi/SkillsStack5 starsTDD, unit/integration/E2E testing, test patterns and verification
testing-strategiesmiles990/claude-software-skills26 starsUnit, integration, E2E testing and TDD practices
jutsu-pytestTheBushidoCollective/han201 starsComprehensive Pytest testing framework skills for Python projects with fixtures, plugins, and advanced testing patterns.