PyTestPilot
AI-powered test case generator for Python, built with Google Gemini.
Features
- Automatically generates professional
pytest test cases using Gemini AI
- Supports both functions and OOP — classes, methods, and inheritance
- Extracts all functions and classes from your Python file automatically
- Uses
pytest fixtures for proper class instantiation in tests
- Tests edge cases like zero, negative numbers, empty strings, and more
- Creates a
test_yourfile.py file alongside your source file
- One-click button to run generated tests directly in the terminal
- Right-click any
.py file to generate tests instantly
Setup
- Get a free Gemini API key from aistudio.google.com
- Open VSCode Settings (
Ctrl+,)
- Search for PyTestPilot
- Paste your API key in the Gemini Api Key field
Usage
Option 1 — Command Palette
- Open a Python file
- Press
Ctrl+Shift+P
- Type
PyTestPilot: Generate Tests and hit Enter
Option 2 — Right Click
- Right-click any
.py file in the Explorer or Editor
- Select PyTestPilot: Generate Tests
Running Tests
- Open the generated
test_yourfile.py file
- Click the play button in the top right of the editor toolbar
- pytest runs automatically in the terminal
Requirements
- Python installed on your system
- pytest installed (
pip install pytest)
- A free Gemini API key from aistudio.google.com
Note
PyTestPilot works best with Python files that contain defined functions or classes. Files with no functions or classes will not generate tests.
Author
Gunveer Singh
If you find PyTestPilot useful, consider leaving a star review on the marketplace!
| |