Agent skill

Mocking Test Generator

by ArabelaTso in ArabelaTso/Skills-4-SE

Generate unit tests with proper mocking for Python (unittest.mock/pytest) or Java (Mockito/JUnit) code.

Apache-2.0Auto-check passedTesting & QA

Install Mocking Test Generator

skills CLI
$ npx skills add ArabelaTso/Skills-4-SE --skill mocking-test-generator -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ArabelaTso/Skills-4-SE mocking-test-generator --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ArabelaTso/Skills-4-SE.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/mocking-test-generator .claude/skills/mocking-test-generator && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
mocking-test-generator
GitHub stars
253
Token cost
~1.6k tokens
SKILL.md length
583 words
Files
3 (incl. references)
Skills in repo
151
Repo updated
First seen
Licence
Apache-2.0

At a glance

Generate unit tests with proper mocking for Python (unittest.mock/pytest) or Java (Mockito/JUnit) code.

  • Works in 5 steps: Analyze the Code → Select Framework → Generate Mocks → …
  • Users request test generation
  • SKILL.md covers Workflow, Step 1: Analyze the Code, Step 2: Select Framework and Step 3: Generate Mocks, plus 6 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Mocking Test Generator is an agent skill from ArabelaTso/Skills-4-SE. Generate unit tests with proper mocking for Python (unittest.mock/pytest) or Java (Mockito/JUnit) code. Use when users request test generation, unit tests with mocks, or testing code that has external dependencies like database calls, API requests, file I/O, or network operations. Automatically identifies dependencies to mock and creates executable, maintainable test code.

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including reference files (for example `references/java_patterns.md` and `references/python_patterns.md`).

It sits in Testing & QA, covering Unit testing and Test generation. It works with Java, Python, pytest and JUnit. The repository describes itself as: A curated list of 180+ useful Claude Skills for Software Engineering and resources for customizing AI for SE workflows. The licence is Apache-2.0.

When your agent uses it

  • Users request test generation
  • Unit tests with mocks
  • Testing code that has external dependencies like database calls
  • Network operations

Example prompts

  • “/mocking-test-generator”

Requirements

  • Python 3

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Analyze the Code
  2. Select Framework
  3. Generate Mocks
  4. Write Tests
  5. Add Documentation

What it can do on your machine

Read from SKILL.md and the folder at commit 4f38503. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python and java).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Mocking Test Generator loads about 1.6k tokens when it runs, and up to ~3.9k if it reads all its reference files. Until then it costs about 100 tokens; SKILL.md has 583 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~100
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from ArabelaTso/Skills-4-SE at commit 4f38503, republished under its Apache-2.0 licence (© ArabelaTso). 583 words, ~1,574 tokens.

Download SKILL.mdSave it as .claude/skills/mocking-test-generator/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
mocking-test-generator
description
Generate unit tests with proper mocking for Python (unittest.mock/pytest) or Java (Mockito/JUnit) code. Use when users request test generation, unit tests with mocks, or testing code that has external dependencies like database calls, API requests, file I/O, or network operations. Automatically identifies dependencies to mock and creates executable, maintainable test code.

Mocking Test Generator

Generate unit tests with proper mocking of external dependencies for Python and Java code.

Workflow

  1. Analyze the code - Identify external dependencies, side effects, and testable units
  2. Select framework - Determine Python (unittest.mock/pytest) or Java (Mockito/JUnit)
  3. Generate mocks - Create mock objects for external dependencies
  4. Write tests - Generate executable test code with assertions
  5. Add documentation - Include clear comments explaining mocks and test logic

Step 1: Analyze the Code

Read the target code to identify:

  • External dependencies: API clients, database connections, third-party libraries
  • I/O operations: File reads/writes, network requests, system calls
  • Side effects: Email sending, logging, state modifications
  • Testable units: Functions, methods, or classes to test in isolation

Ask clarifying questions if:

  • Multiple functions/classes exist (which to test?)
  • Testing scope is unclear (unit vs integration?)
  • Mock behavior needs specification (return values, exceptions?)

Step 2: Select Framework

Python: Use unittest.mock with pytest or unittest

  • Prefer @patch decorator for external calls
  • Use Mock() objects for complex dependencies
  • Apply pytest.fixture for reusable mocks

Java: Use Mockito with JUnit 5

  • Use @Mock annotation for dependencies
  • Apply @ExtendWith(MockitoExtension.class) to test class
  • Use when().thenReturn() for stubbing

Step 3: Generate Mocks

Identify what to mock:

Always mock:

  • External API calls (HTTP requests, REST clients)
  • Database connections and queries
  • File system operations
  • Network I/O
  • Time/date functions
  • Random number generators
  • Environment variables

Never mock (unless explicitly requested):

  • Internal business logic
  • Pure functions
  • Data structures
  • Simple utilities

For common patterns, reference:

Step 4: Write Tests

Generate test code that:

  1. Imports - Include necessary testing and mocking libraries
  2. Setup - Initialize mocks and test fixtures
  3. Execution - Call the function/method under test
  4. Assertions - Verify expected behavior and outputs
  5. Verification - Confirm mocks were called correctly

Test structure:

python
# Python example
from unittest.mock import patch, Mock
import pytest

@patch('module.external_dependency')
def test_function_name(mock_dependency):
    # Arrange: Setup mock behavior
    mock_dependency.return_value = expected_value

    # Act: Execute function under test
    result = function_under_test(input_data)

    # Assert: Verify results
    assert result == expected_output
    mock_dependency.assert_called_once_with(expected_args)
java
// Java example
@ExtendWith(MockitoExtension.class)
class ServiceTest {
    @Mock
    private ExternalDependency dependency;

    @Test
    void testMethodName() {
        // Arrange: Setup mock behavior
        when(dependency.method()).thenReturn(expectedValue);

        // Act: Execute method under test
        Service service = new Service(dependency);
        String result = service.methodUnderTest();

        // Assert: Verify results
        assertEquals(expectedOutput, result);
        verify(dependency).method();
    }
}

Include:

  • Multiple test cases for different scenarios (happy path, edge cases, errors)
  • Descriptive test names that explain what is being tested
  • Setup/teardown if needed for test isolation

Step 5: Add Documentation

Include comments that explain:

  • What external dependency is being mocked and why
  • What behavior the mock simulates
  • What the test verifies

Keep comments concise and focused on non-obvious aspects.

Show full SKILL.md (236 more words)Show less

Output Format

Provide:

  1. Complete test file - Fully executable with all imports
  2. Test class/module - Properly structured for the framework
  3. Multiple test methods - Cover main scenarios
  4. Clear naming - Descriptive test and variable names

Do not:

  • Modify the original code under test
  • Mock internal logic unless explicitly requested
  • Generate incomplete or pseudo-code tests

Example Usage

User request: "Generate unit tests for this Python function that calls an external API"

Response:

  1. Read the function code
  2. Identify the API call to mock
  3. Generate pytest test file with @patch decorator
  4. Include tests for success case, error handling, and edge cases
  5. Add comments explaining the mock setup

Framework-Specific Notes

Python (pytest):

  • Use @pytest.fixture for reusable mock setups
  • Apply @patch as decorator or context manager
  • Use mock_open for file operations
  • Apply @patch.dict for environment variables

Python (unittest):

  • Use unittest.TestCase base class
  • Apply @patch decorator or patch() context manager
  • Use setUp() and tearDown() methods
  • Call self.assert* methods

Java (Mockito + JUnit 5):

  • Use @ExtendWith(MockitoExtension.class) on test class
  • Apply @Mock for dependencies
  • Use @BeforeEach for setup, @AfterEach for teardown
  • Apply ArgumentCaptor to verify complex arguments
  • Use MockedStatic for static method mocking (Mockito 3.4+)

Common Patterns

Reference files contain detailed examples for:

Python (references/python_patterns.md):

  • External API calls
  • Database operations
  • File system operations
  • Environment variables
  • Time-dependent code
  • Exception handling

Java (references/java_patterns.md):

  • External API calls
  • Database operations
  • File system operations
  • Void methods
  • Exception handling
  • Argument captors
  • Static method mocking
  • Constructor mocking

© ArabelaTso, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (references) in skills/mocking-test-generator of ArabelaTso/Skills-4-SE.

  • SKILL.md
  • references/java_patterns.md
  • references/python_patterns.md

Open the folder on GitHubat commit 4f38503

Compare with similar skills

Mocking Test Generator next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Mocking Test Generator compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Mocking Test Generator this skillArabelaTso/Skills-4-SE253—~1.6kAutomated safety check: PassApache-2.0
TDD GuideLeoYeAI/openclaw-master-skills2.2k—~1.4kAutomated safety check: PassMIT
Test Analysis Extensionsmicrosoft/testfx1k2 repos~1.1kAutomated safety check: PassMIT
TDD Guidealirezarezvani/claude-skills28k—~3.4kAutomated safety check: PassMIT
TDD GuideaAAaqwq/AGI-Super-Team1052 repos~1.1kAutomated safety check: PassMIT
Adk Verify Snippetsgoogle/adk-python22k—~1.4kAutomated safety check: PassApache-2.0

Similar skills

  • TDD Guide

    LeoYeAI/openclaw-master-skills

    Test-driven development skill for writing unit tests, generating test fixtures and mocks, analyzing coverage gaps, and guiding red-green-refactor workflows across Jest, Pytest, JUnit, Vitest, and…

    2.2k GitHub stars~1.4k tokensUpdated 2 mo ago
    Testing & QAAuto-check passed
  • Test Analysis Extensions

    microsoft/testfx

    Official

    Provides file paths to language-specific reference files for the test ANALYSIS skills (assertion-quality, test-anti-patterns, test-gap-analysis, test-smell-detection, test-tagging).

    1k GitHub starsUsed in 2 repos~1.1k tokens
    Testing & QAAuto-check passed
  • TDD Guide

    alirezarezvani/claude-skills

    Test-driven development skill for writing unit tests, generating test fixtures and mocks, analyzing coverage gaps, and guiding red-green-refactor workflows across Jest, Pytest, JUnit, Vitest, and…

    28k GitHub stars~3.4k tokensUpdated 1 mo ago
    Testing & QAAuto-check passed
  • TDD Guide

    aAAaqwq/AGI-Super-Team

    Test-driven development workflow with test generation, coverage analysis, and multi-framework support

    105 GitHub starsUsed in 2 repos~1.1k tokens
    Testing & QAAuto-check passed
  • Adk Verify Snippets

    google/adk-python

    Official

    Checks that every Python code block in a Markdown file actually compiles and runs, by extracting each block to a temporary file, executing it in an isolated subprocess, and writing a pass/fail…

    22k GitHub stars~1.4k tokensUpdated today
    Testing & QAAuto-check passed
  • Hermetic Python Unit Tests

    dimensionalOS/dimos

    Rules for writing, fixing and reviewing pytest unit tests that are hermetic: behavior-focused, deterministic, isolated and cheap to run.

    4.6k GitHub stars~1.4k tokensUpdated yesterday
    Testing & QAAuto-check passed

More from ArabelaTso/Skills-4-SE

All 151 skills in this repo
  • Framework Migration Assistant

    ArabelaTso/Skills-4-SE

    Automatically migrate Python web applications between frameworks (Flask → FastAPI, Django → FastAPI).

    253 GitHub stars~1.9k tokensUpdated 1 mo ago
    Auto-check passed
  • Metamorphic Test Generator

    ArabelaTso/Skills-4-SE

    Generate test cases using metamorphic testing by applying transformations based on metamorphic properties.

    253 GitHub stars~798 tokensUpdated 1 mo ago
    Auto-check passed
  • Reproduction Trace Instrumenter

    ArabelaTso/Skills-4-SE

    Instruments programs to capture execution traces specifically for reproducing reported bugs, enabling consistent replay and diagnosis of failures.

    253 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Spring Mvc To Boot Migrator

    ArabelaTso/Skills-4-SE

    Automatically migrate Spring MVC applications to Spring Boot.

    253 GitHub stars~2.2k tokensUpdated 1 mo ago
    Auto-check passed
  • State Snapshot Instrumenter

    ArabelaTso/Skills-4-SE

    Instrument programs (Python, C/C++, Java) to capture snapshots of key program states at runtime, including variables, memory, and call stacks.

    253 GitHub stars~2.2k tokensUpdated 1 mo ago
    Auto-check passed

Categories

Questions about Mocking Test Generator

What does Mocking Test Generator do?

Generate unit tests with proper mocking for Python (unittest.mock/pytest) or Java (Mockito/JUnit) code. Mocking Test Generator is an agent skill from ArabelaTso/Skills-4-SE.mock/pytest) or Java (Mockito/JUnit) code.

When should I use Mocking Test Generator?

Mocking Test Generator fits situations like: users request test generation; unit tests with mocks; testing code that has external dependencies like database calls; network operations.

How do I install Mocking Test Generator in Claude Code?

Run `npx skills add ArabelaTso/Skills-4-SE --skill mocking-test-generator -a claude-code`. Or copy the skill folder (skills/mocking-test-generator in ArabelaTso/Skills-4-SE) into .claude/skills/mocking-test-generator in your project. Claude Code loads it when a task matches its description.

How do I install Mocking Test Generator in Codex?

Run `npx skills add ArabelaTso/Skills-4-SE --skill mocking-test-generator -a codex`. Or copy the skill folder (skills/mocking-test-generator in ArabelaTso/Skills-4-SE) into .agents/skills/mocking-test-generator in your project. Codex loads it when a task matches its description.

Can I use Mocking Test Generator in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ArabelaTso/Skills-4-SE --skill mocking-test-generator -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/mocking-test-generator, .gemini/skills/mocking-test-generator, .github/skills/mocking-test-generator and .opencode/skills/mocking-test-generator in your project.

What does Mocking Test Generator need to run?

SKILL.md names no scripts, command-line tools or credentials: Mocking Test Generator is instructions for the agent only. Our summary lists: Python 3.

Does Mocking Test Generator access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Mocking Test Generator safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Mocking Test Generator use?

Mocking Test Generator is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Mocking Test Generator use?

About 1.6k tokens (SKILL.md is roughly 6.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 2.4k tokens, read only when the agent opens those files.

What are the alternatives to Mocking Test Generator?

Skills that share tags, products or a category with Mocking Test Generator: TDD Guide (LeoYeAI/openclaw-master-skills, 2.2k stars), Test Analysis Extensions (microsoft/testfx, 1k stars), TDD Guide (alirezarezvani/claude-skills, 28k stars) and TDD Guide (aAAaqwq/AGI-Super-Team, 105 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Mocking Test Generator?

ArabelaTso (a GitHub user) maintains it in ArabelaTso/Skills-4-SE, which has 253 GitHub stars. The repository holds 151 skills in this directory. The repository was last updated on August 21, 2026.

Source: ArabelaTso/Skills-4-SE on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.