Test Generation
Generate comprehensive, idiomatic tests from your feature inventory using AI. From unit tests to end-to-end coverage, the generation engine fills the gaps your test suite is missing.
Overview
The TestOps test generation engine uses AI-powered code generation to produce real, runnable tests directly from your feature inventory. Under the hood, it leverages Claude Code running directly on the target server where your project lives. This means the AI has full access to your codebase, dependencies, and environment -- enabling it to generate idiomatic tests that match your project's existing testing conventions. Rather than producing generic boilerplate, the generator analyzes how your team already writes tests and follows the same patterns, naming conventions, and assertion styles.
How It Works
The generation engine operates in a multi-step pipeline. First, it reads your project's feature inventory -- the structured map of endpoints, models, services, and integrations produced by the discovery engine. It then cross-references this inventory against the gap analysis findings to understand exactly which features lack test coverage and what kind of tests are needed.
The engine also ingests several context sources to produce high-quality output:
- --Your
CLAUDE.mdfile for project-specific instructions, coding standards, and architectural decisions - --Existing test files to learn your conventions, import patterns, and helper utilities
- --Database schema definitions and migration files for accurate model and relationship understanding
- --Environment configuration so integration tests can reference correct service URLs, database connections, and API keys
Generating Tests from Inventory
The primary workflow for test generation starts from your project's feature inventory. On the project page, navigate to the Inventory tab. Here you will see the full list of discovered features organized by category -- API endpoints, database models, service classes, background jobs, and more.
Select the features you want tests for using the checkboxes. You can select individual features, entire categories, or use the select-all option. Once your selection is ready, click the Generate Tests button in the action bar.
The engine then generates tests across all relevant layers for each selected feature. For an API endpoint, this might include a unit test for the handler logic, an integration test for the database queries, and an end-to-end test for the full request/response cycle. The generation runs as a background job on your connected server, so you can continue working while tests are being produced.
Generating Fixes from Gap Findings
The gap analysis engine identifies specific weaknesses in your test suite -- missing edge cases, uncovered error paths, untested authorization rules, and more. Each of these findings can be addressed directly from the Gaps tab on your project page.
Individual findings display a Generate Fix button. Clicking it triggers the AI to produce two outputs: the code fix itself (if the gap is caused by a missing implementation) and a matching test that verifies the fix works correctly. This ensures that every remediation is immediately backed by a passing test.
For example, if the gap analysis identifies that a payment endpoint lacks validation for negative amounts, the generator will produce both the validation logic and a test asserting that negative amounts are rejected with the appropriate error response.
Supported Test Frameworks
The generator automatically detects which test framework your project uses and produces idiomatic code for that framework. There is no manual configuration required -- the engine inspects your package.json, pyproject.toml, .csproj, or go.mod files to determine the stack.
Modern unit and integration tests with native ESM support, compatible with the Vite ecosystem.
Fixture-based testing with parametrize decorators, async support, and factory-boy integration.
Strongly-typed test classes with dependency injection, Theory data attributes, and FluentAssertions.
Table-driven tests using the standard library testing package with subtests and testify assertions.
Cross-browser end-to-end tests with page object models, auto-waiting, and trace recording.
Context-Aware Generation
What separates TestOps generation from generic AI code generation is deep context awareness. The engine does not operate in isolation -- it reads and understands your entire project before writing a single line of test code.
- --CLAUDE.md-- Your project's AI instruction file. Include coding standards, architectural patterns, naming conventions, and any rules the generator should follow. For example, specifying that all API tests should use a shared
createTestClient()helper ensures generated tests integrate cleanly with your existing suite. - --Database Schema -- Migration files, Prisma schemas, SQLAlchemy models, or Entity Framework configurations are parsed to understand relationships, constraints, and data types. This enables the generator to create realistic test data and validate foreign key constraints.
- --Existing Tests -- The engine samples your existing test files to learn import patterns, assertion libraries, helper functions, test data factories, and file naming conventions. Generated tests feel like they were written by your team.
- --Environment Configuration -- For integration and end-to-end tests, the engine reads your
.envand configuration files to reference correct database URLs, service endpoints, and API base paths. Sensitive values are never hardcoded -- environment variable references are used instead.
Reviewing Generated Tests
After the generation job completes, the results appear in the test generation results panel on your project page. Each generated test file is displayed with syntax-highlighted code, the target file path, and the feature it covers.
You can review each test inline, expand or collapse individual files, and make modifications directly in the editor before committing. Generated tests follow your project's file structure conventions -- if your tests live in a __tests__ directory next to source files, the generated tests will be placed there. If you use a top-level tests/ directory, they will follow that pattern instead.
Once you are satisfied with the generated tests, commit them to your repository. The platform tracks which tests were AI-generated so you can filter and audit them later.
Best Practices
- 01Keep CLAUDE.md up to date. The more specific your project instructions are, the better the generated tests will be. Include your preferred assertion library, test data patterns, and any anti-patterns to avoid.
- 02Run discovery before generation. The feature inventory is the input to the generation engine. A stale inventory means the generator may miss new features or produce tests for code that has changed. Always run a fresh discovery scan before kicking off test generation.
- 03Review generated tests before committing. AI-generated tests are a starting point, not a finished product. Review them for correctness, ensure assertions are meaningful (not just checking for truthy values), and verify that test data is realistic for your domain.
- 04Generate incrementally. Rather than generating tests for your entire codebase at once, start with the highest-priority gaps identified by the gap analysis. This makes review manageable and ensures you focus on the areas that matter most.
- 05Run generated tests immediately. Use the test execution engine to run your newly generated tests right away. This catches any issues with imports, environment setup, or test data before you commit to your repository.