GitAuto Logo
  1. Home
  2. Pricing
  3. Docs
  4. Dashboard
  5. Blog
  6. Contact
  1. Home
  2. How It Works
  3. Use Cases
  4. Pricing
  5. Docs
  6. Dashboard
  7. FAQ
  8. Blog
  9. Contact

Test File Preloading

Before the agent loop starts, GitAuto scans the repository for existing test files and pre-loads existing test files into the model's context. These serve as concrete examples of the project's testing patterns, import conventions, and assertion styles.

Why This Exists

Without existing test files in context, generated tests are inconsistent with the rest of the codebase: wrong import paths, different test framework usage, unfamiliar assertion styles, and missed helper utilities. Every generated test feels like it was written by someone who had never seen the codebase. Pre-loading real test files from the repo teaches the model by example. If your tests use a custom render helper, the model sees it. If your tests follow a specific describe/it nesting pattern, the model replicates it. If your tests import from @testing-library/react with specific utilities, the model picks up that convention automatically.

Why Models Prefer Creating Over Finding

Models have a strong bias toward generating new content rather than searching for existing content. Searching requires multiple tool calls with uncertain outcomes - the model has to guess file paths, run searches, interpret results, and try again if nothing comes back. Creating a new file is a single confident action with a guaranteed result. Left unchecked, the model will attempt a few searches, find nothing (or give up early), and create a brand new test file - ignoring the existing test suite's patterns, helpers, and conventions entirely. This is why GitAuto performs the search outside the model and injects the results before the model starts.

How It Works

GitAuto discovers test files through two methods: path matching (walking the file tree for test files whose path contains the implementation file's stem) and content grep (finding test files that reference the stem in their source code). This hybrid approach catches both colocated tests and tests in separate directories that import the implementation file.

Discovered test files are then ranked by relevance using a scoring system: name match (+100 if the test file name contains the implementation stem), same directory (+50), shared path components (+10 per shared component), and a distance penalty. The top 5 most relevant test files are included with their full contents. Any remaining test files are listed as paths so the model knows they exist without consuming context budget.

This is critical because the model will happily give up searching after a few attempts and create a new file instead. By doing the search and ranking upfront outside the model, GitAuto guarantees that the most relevant existing tests are found and their content is injected into the initial context before the model begins its work.

Related Features

  • Test Naming Detection - detects the dominant naming convention across all test files
  • Coding Standards - codified rules that complement the examples from preloaded files

Need Help?

Have questions or suggestions? We're here to help you get the most out of GitAuto.

Contact us with your questions or feedback!

Full File ReadsTest Naming Detection

Getting Started

  • Installation
  • Setup

Triggers

  • Overview
  • Schedule Trigger
  • Test Failure Trigger
  • Review Comment Trigger
  • Dashboard Trigger

Coverage Dashboard

  • Overview
  • Python Testing
  • JavaScript Testing
  • Java Testing
  • Go Testing
  • PHP Testing
  • Ruby Testing
  • Flutter Testing
  • Multi-Language
  • Coverage Charts

Customization

  • Repository Rules
  • Output Language
  • GITAUTO.md

Integrations

  • CircleCI Integration
  • npm Integration

How It Works

Context Enrichment

  • Line Numbers
  • Full File Reads
  • Test File Preloading
  • Test Naming Detection
  • Error Baselines
  • CI Log Cleaning
  • Trigger-Specific Prompts
  • Coding Standards

Output Auto-Correction

  • Diff Hunk Repair
  • Diff Prefix Repair
  • Tool Name Correction
  • Tool Argument Correction
  • Import Sorting
  • Trailing Space Removal
  • Final Newline
  • Line Ending Preservation
  • Sanitize Tool Arguments
  • Lint Disable Headers

Quality Verification

  • Formatting
  • Linting
  • Type Checking
  • Test Execution
  • Coverage Enforcement
  • phpcs / phpstan Support
  • PHPUnit Support
  • pytest Support
  • Snapshot Auto-Update
  • Untestable Detection
  • Should-Skip Detection
  • Dead Code Removal
  • Quality Check Scoring
  • Quality Checklist

Safety Guardrails

  • File Edit Restrictions
  • Temperature Zero
  • PR/Branch Checks
  • Race Condition Prevention
  • Bot Loop Prevention
  • Webhook Deduplication
  • Duplicate Error Hashing
  • Infrastructure Failure Detection
  • Strict Tool Schemas
  • No-Change Detection

Token/Cost Management

  • Token Trimming
  • Outdated Diff Removal
  • Stale File Replacement
  • Skip CI Intermediate
  • CI Log Deduplication
  • Web Fetch Summarization
  • Context Forgetting
  • File Query Routing
  • On-Demand Diff

Resilience & Recovery

  • Model Fallback
  • Overload Retry
  • Forced Verification
  • Error Files Editable

Hallucination Prevention

  • Web Search
  • URL Fetching
  • Anti-Hallucination Prompts
  • GITAUTO.md Restrictions
  • Review Response Guardrails

Ready to improve your test coverage?

Go from 0% to 90% test coverage with GitAuto. Start for free, no credit card required.

Install FreeContact Sales

Product

  • Home
  • Why GitAuto
  • What GitAuto Does
  • How It Works
  • Use Cases
  • How to Get Started
  • Solution
  • Pricing
  • Pricing Details
  • ROI Calculator
  • ROI Methodology
  • FAQ
  • Blog
  • Contact

Dashboard

  • Dashboard
  • Coverage Trends
  • File Coverage
  • Credits
  • Open PRs
  • Usage
  • Triggers
  • Actions
  • References
  • Rules
  • CircleCI Integration
  • npm Integration

Documentation

  • Docs
  • Getting Started
  • Setup
  • Triggers
  • Coverage Setup
  • Customization
  • How It Works
  • Auto Merge
  • CircleCI
  • npm

Legal

  • Privacy Policy
  • Terms of Service

Connect

  • GitHub
  • LinkedIn
  • Twitter
  • YouTube
GitAuto Logo© 2026 GitAuto, Inc. All Rights Reserved