models

package
v0.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package models contains shared data structures used throughout TestGen.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AST

type AST struct {
	Language    string        `json:"language"`
	Definitions []*Definition `json:"definitions"`
	Imports     []string      `json:"imports"`
	Package     string        `json:"package,omitempty"`
}

AST represents a parsed abstract syntax tree

type Definition

type Definition struct {
	Name       string  `json:"name"`
	Signature  string  `json:"signature"`
	Body       string  `json:"body"`
	StartLine  int     `json:"start_line"`
	EndLine    int     `json:"end_line"`
	IsMethod   bool    `json:"is_method"`
	ClassName  string  `json:"class_name,omitempty"`
	Parameters []Param `json:"parameters,omitempty"`
	ReturnType string  `json:"return_type,omitempty"`
	Docstring  string  `json:"docstring,omitempty"`
}

Definition represents a function or method extracted from source code

type GeneratedTest

type GeneratedTest struct {
	TestName      string   `json:"test_name"`
	TestCode      string   `json:"test_code"`
	Imports       []string `json:"imports"`
	CoverageLines []string `json:"coverage_lines,omitempty"`
	EdgeCases     []string `json:"edge_cases_covered,omitempty"`
	Dependencies  []string `json:"mocked_dependencies,omitempty"`
}

GeneratedTest represents a test generated by the LLM

type GenerationResult

type GenerationResult struct {
	SourceFile      *SourceFile `json:"source_file"`
	TestCode        string      `json:"test_code,omitempty"`
	TestPath        string      `json:"test_path,omitempty"`
	FunctionsTested []string    `json:"functions_tested,omitempty"`
	TestCount       int         `json:"test_count"`
	Error           error       `json:"-"`
	ErrorMessage    string      `json:"error,omitempty"`
}

GenerationResult represents the result of generating tests for a file

type Param

type Param struct {
	Name string `json:"name"`
	Type string `json:"type,omitempty"`
}

Param represents a function parameter

type SourceFile

type SourceFile struct {
	Path      string   `json:"path"`
	Language  string   `json:"language"`
	Framework string   `json:"framework,omitempty"`
	Content   string   `json:"-"` // Not serialized
	LineCount int      `json:"line_count"`
	Functions []string `json:"functions,omitempty"`
}

SourceFile represents a source file to generate tests for

type TestResults

type TestResults struct {
	ExitCode     int      `json:"exit_code"`
	Output       string   `json:"output"`
	Coverage     float64  `json:"coverage_percent,omitempty"`
	PassedCount  int      `json:"passed"`
	FailedCount  int      `json:"failed"`
	SkippedCount int      `json:"skipped"`
	Duration     float64  `json:"duration_seconds"`
	Errors       []string `json:"errors,omitempty"`
}

TestResults represents the outcome of running tests

type UsageMetrics

type UsageMetrics struct {
	RunID          string  `json:"run_id"`
	Timestamp      string  `json:"timestamp"`
	TotalFiles     int     `json:"total_files"`
	TokensInput    int     `json:"tokens_input"`
	TokensOutput   int     `json:"tokens_output"`
	TokensCached   int     `json:"tokens_cached"`
	CacheHitRate   float64 `json:"cache_hit_rate"`
	TotalCostUSD   float64 `json:"total_cost_usd"`
	ExecutionTimeS float64 `json:"execution_time_seconds"`
	SuccessCount   int     `json:"success_count"`
	ErrorCount     int     `json:"error_count"`
}

UsageMetrics tracks API usage and costs

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL