AI-powered tool to automatically generate compliant unit tests for FastAPI controllers and service layers, enforcing strict project standards.
Project description
Agtest-AI: Automated Test Generation Agent
Agtest-AI is an intelligent command-line tool and Python library that automatically generates unit tests for FastAPI-based applications. It analyzes source code (controllers and services), understands dependencies and logic, and produces complete, production-ready pytest files that align with your project’s testing standards.
Purpose
To automate the generation of realistic and maintainable FastAPI unit tests. Agtest-AI eliminates repetitive manual effort and ensures consistent, rule-compliant testing across projects.
Key Features
Automatic File Type Detection — Identifies whether the input file is a controller or service. AI-Powered Test Generation — Uses Google Gemini API to analyze source code and generate test cases. Project-Standard Compliance — Follows internal test structures, including: -Mocked DB sessions (MagicMock(spec=Session)) -Configured TestClient with middleware and dependency overrides -Exception handling for both sync and async endpoints -Separate success and failure test cases per route -Configurable Output — Control the output directory and generation parameters. -Role-Aware Prompts — Creates distinct instructions for controllers and services to ensure context-aware test generation.
Configuration
Agtest-AI supports environment-based configuration for flexible setup:-MODEL_NAME,MAX_TOKENS,TEMPERATURE,API_KEY The output directory can be modified directly in the runner configuration.
Installation pip install agtest
Usage Run the agent directly from the command line: agent-cli
You’ll be prompted to provide: File path for test generation Gemini API key Output directory Router file path (for controllers)
The generated tests will be saved as:tests_.py
Why Agtest-AI: Save hours of manual testing effort. Maintain consistent and accurate unit tests. Improve test coverage automatically.
It supports google gemini api key and paid vertion of OpenAI api key. It gives line and file coverage of above 85%. License Distributed under the MIT License. See LICENSE for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agtest-0.2.2.tar.gz.
File metadata
- Download URL: agtest-0.2.2.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c85f4e61896f48bff80d9f8090087e89704ead7b05b131332be6f3ea8a78701c
|
|
| MD5 |
38ae6048bad8e811d48ee8d47b988a61
|
|
| BLAKE2b-256 |
44fa60faaffe92481260478883586e39648df1506453fc4ea4213d93a79e234b
|
File details
Details for the file agtest-0.2.2-py3-none-any.whl.
File metadata
- Download URL: agtest-0.2.2-py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b910ff27bb748bd30e9616d07fd81f8939a27c4d9fe7c82e1b474fdd393cbd52
|
|
| MD5 |
c3f3420032b5d34f233956029516a972
|
|
| BLAKE2b-256 |
0a01b06922f7577397c42a95e6e2eeb06471ec4180e1d496d61a3d6fb6b58de2
|