test-generator

Generate pytest test scaffolds from Python source code using AST analysis.

17|45|Updated Jan 23, 2026
One-click install
npx skills add https://github.com/XSpoonAi/spoon-awesome-skill --skill test-generator-xspoonai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-generator
Source: https://github.com/XSpoonAi/spoon-awesome-skill/tree/main/enterprise-skills/testing
Command: npx skills add https://github.com/XSpoonAi/spoon-awesome-skill --skill test-generator-xspoonai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Automates the creation of pytest test scaffolds from Python source code, enabling rapid test bootstrapping and better test coverage.

Core Features & Use Cases

  • AST Parsing: Safely analyzes code structure without executing it.
  • Smart Scaffolding: Generates test functions for public classes, methods, and functions.
  • Pytest Ready: Outputs a ready-to-run pytest scaffold in a standard layout.
  • Non-Destructive: Does not overwrite existing test files unless forced.

Use Case: Quickly bootstrap tests for legacy or newly authored Python modules.

Quick Start

Run the tool with the path to a Python file to generate a matching pytest skeleton in the tests directory.

Frequently Asked Questions about test-generator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I auto-generate pytest scaffolds from Python source code?

Auto-generate pytest scaffolds from Python source code by parsing the AST to map code constructs to test stubs. The tool writes a test_<module>.py file in a designated output directory to bootstrap your tests quickly.

What is AST-based test generation and how does it work for Python?

AST-based test generation uses abstract syntax tree parsing to safely analyze Python code structure without executing it. It maps public classes, methods, and functions to standard pytest test stubs in a ready-to-run layout.

Does the pytest test generator overwrite existing test files?

The pytest test generator does not overwrite existing test files by default. It skips overwrites to protect existing tests unless you explicitly force the overwrite flag during generation.

Can I use this to bootstrap unit tests for legacy Python modules?

You can bootstrap unit tests for legacy Python modules by analyzing the source code structure. The tool generates matching pytest skeletons for public functions and classes, enabling rapid test coverage for older codebases.

What is the best way to create a pytest skeleton for a Python module?

The best way to create a pytest skeleton is to run the tool with the path to a Python file. It parses the code structure and outputs a ready-to-run pytest scaffold in a standard layout within your tests directory.