Skip to main content

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.

Metadata

Release files for agtest 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agtest 0.2.3
File Size Uploaded Provenance
agtest-0.2.3.tar.gz 14.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for agtest 0.2.3
File Interpreter ABI Platform
agtest-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 29.1 kB

Release files / agtest-0.2.3.tar.gz

Download URL agtest-0.2.3.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ddee8fd7968365b64568125e6e67d248d9d140fb537ca6ff40a375df68eb4266
BLAKE2b-256 checksum
How to use checksums
fa5f8f6fe253a7b6cddf9542db6e615ba0bcd9e4c31190981efb84391d3ef9fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release files / agtest-0.2.3-py3-none-any.whl

Download URL agtest-0.2.3-py3-none-any.whl
Size 14.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d7eef7b7d52244a544cbe96a5796d63f60cbb0ba3138e2fe4bb8033f597c2d7
BLAKE2b-256 checksum
How to use checksums
8482de250eb3e0bbfb389732da80d644f7a0f32877dc9343bd5cf5d4b8467f2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Security for agtest 0.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page