Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
aidotnet avatar

Test Generator

  • 22 installs
  • 84 repo stars
  • Updated January 28, 2026
  • aidotnet/moyucode

test-generator is a Claude Code skill that generates unit, integration, and E2E test suites with mocks and edge cases for Jest, Vitest, pytest, and xUnit.

About

test-generator is a Claude Code prompt skill that writes test suites for existing code. It produces unit, integration, and E2E tests with mocks and edge-case coverage across Jest, Vitest, pytest, and xUnit. A developer uses it to add test coverage to a codebase.

  • Generates unit, integration, and E2E test suites
  • Covers Jest, Vitest, pytest, and xUnit
  • Includes mocks and edge-case coverage

Test Generator by the numbers

  • 22 all-time installs (skills.sh)
  • Ranked #1,412 of 2,153 Testing & QA skills by installs in the Skillselion catalog
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

test-generator capabilities & compatibility

Capabilities
test generation · unit testing · integration testing · e2e testing · mocking
Use cases
testing · code review
Pricing
Free
From the docs

What test-generator says it does

Generate comprehensive test suites with unit tests, integration tests, mocks, and edge case coverage.
SKILL.md
You are a testing expert that creates comprehensive test suites.
SKILL.md
npx skills add https://github.com/aidotnet/moyucode --skill test-generator

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs22
repo stars84
Last updatedJanuary 28, 2026
Repositoryaidotnet/moyucode

What it does

Generate unit, integration, and E2E tests with mocks and edge cases across Jest, Vitest, pytest, and xUnit.

Who is it for?

Adding unit, integration, and E2E test coverage to an existing codebase.

When should I use this skill?

You need to generate tests for a class, module, or service.

What you get

Produces framework-appropriate test files with mocks and edge-case assertions.

  • unit test files
  • integration test files
  • mocks and edge-case assertions

By the numbers

  • Targets 4 test frameworks: Jest, Vitest, pytest, xUnit
  • Covers 3 test types: unit, integration, E2E

Files

SKILL.mdMarkdownGitHub ↗

Test Generator Skill

Description

Generate comprehensive test suites with unit tests, integration tests, mocks, and edge case coverage.

Trigger

  • /test command
  • User requests test generation
  • User needs test coverage

Prompt

You are a testing expert that creates comprehensive test suites.

Jest/Vitest Unit Tests (TypeScript)

import { describe, it, expect, vi, beforeEach } from 'vitest';
import { UserService } from './UserService';
import { UserRepository } from './UserRepository';

// Mock the repository
vi.mock('./UserRepository');

describe('UserService', () => {
  let userService: UserService;
  let mockRepository: jest.Mocked<UserRepository>;

  beforeEach(() => {
    mockRepository = new UserRepository() as jest.Mocked<UserRepository>;
    userService = new UserService(mockRepository);
    vi.clearAllMocks();
  });

  describe('createUser', () => {
    it('should create a user with valid data', async () => {
      // Arrange
      const userData = { email: 'test@example.com', name: 'Test User' };
      const expectedUser = { id: '123', ...userData, createdAt: new Date() };
      mockRepository.create.mockResolvedValue(expectedUser);

      // Act
      const result = await userService.createUser(userData);

      // Assert
      expect(result).toEqual(expectedUser);
      expect(mockRepository.create).toHaveBeenCalledWith(userData);
      expect(mockRepository.create).toHaveBeenCalledTimes(1);
    });

    it('should throw error for duplicate email', async () => {
      // Arrange
      const userData = { email: 'existing@example.com', name: 'Test' };
      mockRepository.create.mockRejectedValue(new Error('DUPLICATE_EMAIL'));

      // Act & Assert
      await expect(userService.createUser(userData))
        .rejects.toThrow('DUPLICATE_EMAIL');
    });

    it('should validate email format', async () => {
      // Arrange
      const invalidData = { email: 'invalid-email', name: 'Test' };

      // Act & Assert
      await expect(userService.createUser(invalidData))
        .rejects.toThrow('INVALID_EMAIL');
    });
  });

  describe('getUserById', () => {
    it('should return user when found', async () => {
      const user = { id: '123', email: 'test@example.com', name: 'Test' };
      mockRepository.findById.mockResolvedValue(user);

      const result = await userService.getUserById('123');

      expect(result).toEqual(user);
    });

    it('should return null when user not found', async () => {
      mockRepository.findById.mockResolvedValue(null);

      const result = await userService.getUserById('nonexistent');

      expect(result).toBeNull();
    });
  });
});

pytest (Python)

import pytest
from unittest.mock import Mock, patch
from user_service import UserService

class TestUserService:
    @pytest.fixture
    def mock_repository(self):
        return Mock()

    @pytest.fixture
    def user_service(self, mock_repository):
        return UserService(mock_repository)

    def test_create_user_success(self, user_service, mock_repository):
        # Arrange
        user_data = {"email": "test@example.com", "name": "Test User"}
        expected = {"id": "123", **user_data}
        mock_repository.create.return_value = expected

        # Act
        result = user_service.create_user(user_data)

        # Assert
        assert result == expected
        mock_repository.create.assert_called_once_with(user_data)

    def test_create_user_duplicate_email(self, user_service, mock_repository):
        mock_repository.create.side_effect = ValueError("DUPLICATE_EMAIL")

        with pytest.raises(ValueError, match="DUPLICATE_EMAIL"):
            user_service.create_user({"email": "existing@example.com"})

    @pytest.mark.parametrize("invalid_email", [
        "invalid",
        "@example.com",
        "test@",
        "",
    ])
    def test_validate_email_invalid(self, user_service, invalid_email):
        with pytest.raises(ValueError, match="INVALID_EMAIL"):
            user_service.create_user({"email": invalid_email, "name": "Test"})

xUnit (C#)

public class UserServiceTests
{
    private readonly Mock<IUserRepository> _mockRepository;
    private readonly UserService _userService;

    public UserServiceTests()
    {
        _mockRepository = new Mock<IUserRepository>();
        _userService = new UserService(_mockRepository.Object);
    }

    [Fact]
    public async Task CreateUser_WithValidData_ReturnsUser()
    {
        // Arrange
        var userData = new CreateUserDto { Email = "test@example.com", Name = "Test" };
        var expectedUser = new User { Id = Guid.NewGuid(), Email = userData.Email };
        _mockRepository.Setup(r => r.CreateAsync(It.IsAny<User>()))
            .ReturnsAsync(expectedUser);

        // Act
        var result = await _userService.CreateUserAsync(userData);

        // Assert
        Assert.Equal(expectedUser.Email, result.Email);
        _mockRepository.Verify(r => r.CreateAsync(It.IsAny<User>()), Times.Once);
    }

    [Theory]
    [InlineData("")]
    [InlineData("invalid")]
    [InlineData("@example.com")]
    public async Task CreateUser_WithInvalidEmail_ThrowsValidationException(string email)
    {
        var userData = new CreateUserDto { Email = email, Name = "Test" };

        await Assert.ThrowsAsync<ValidationException>(
            () => _userService.CreateUserAsync(userData));
    }
}

Tags

testing, unit-tests, integration-tests, tdd, quality-assurance

Compatibility

  • Codex: ✅
  • Claude Code: ✅

Related skills

FAQ

Which test frameworks does it support?

Jest, Vitest, pytest, and xUnit per the skill description.

What kinds of tests does it write?

Unit, integration, and E2E tests with mocks and edge-case coverage.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.