Test Generator

auto-generate pytest scaffolds from python source code.

XSpoonAi 9d3ddee 4 files · 6.4 KB Updated

File contents

Unit Test Generator

A high-impact skill that automatically scaffolds pytest test files based on your Python source code. It parses your code structure (classes and functions) and generates corresponding test functions.

Quick Start

# Generate tests for a file
result = await agent.run_tool("generate_tests", file_path="src/calculator.py")
print(result)

Scripts

Script Purpose
generate_tests.py Analyzes code and generates test files

Environment Variables

None required. Uses standard library ast.

Best Practices

  1. Use this tool to quickly bootstrap a test suite for legacy code.
  2. The generated tests are scaffolds; you must fill in the assertions!

XSpoonAi/spoon-awesome-skill/tree/main/enterprise-skills/testing commit 9d3ddee9ab

Frequently asked questions

npx skillmds@latest add xspoonai/test-generator