Documentation
¶
Overview ¶
Package testrun detects the project test framework, runs tests, and pipes failures to the AI provider for root-cause diagnosis and fix suggestions.
Index ¶
- func DiagnosePrompt(fw *Framework, failures []TestFailure, taskContext string) string
- func FixPrompt(fw *Framework, diags []Diagnosis, summary string) string
- func FormatReport(r *Report) string
- func WriteReportArtifact(workDir string, taskID int, report *Report) (string, error)
- type Diagnosis
- type Framework
- type Report
- type Result
- type TestFailure
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DiagnosePrompt ¶
func DiagnosePrompt(fw *Framework, failures []TestFailure, taskContext string) string
DiagnosePrompt builds the AI prompt for analyzing test failures.
func FormatReport ¶
FormatReport renders a human-readable test report.
Types ¶
type Diagnosis ¶
type Diagnosis struct {
TestName string `json:"test_name"`
RootCause string `json:"root_cause"`
FixStrategy string `json:"fix_strategy"`
}
Diagnosis is the AI-generated root-cause + fix strategy for one failure.
type Framework ¶
type Framework struct {
Name string // human-readable name, e.g. "go test", "pytest"
Command []string // executable + args, e.g. ["go", "test", "./..."]
Lang string // "go", "python", "node", "rust", "shell"
}
Framework describes a detected test framework and how to run it.
func Detect ¶
Detect probes workDir for known project files and returns the best matching Framework. It checks in priority order:
- Go (go.mod)
- Rust (Cargo.toml)
- Python (pytest via pyproject.toml / setup.cfg / requirements / .py files)
- Node with vitest (package.json + vitest)
- Node with jest (package.json + jest)
- Node with npm test (package.json fallback)
type Report ¶
type Report struct {
Framework string
Passed int
Failed int
Skipped int
Diagnoses []Diagnosis
RawOutput string
AISummary string
}
Report is the final output of the test command.
type Result ¶
type Result struct {
Framework Framework
Passed int
Failed int
Skipped int
Failures []TestFailure
RawOutput string // combined stdout + stderr
ExitCode int
}
Result holds the combined output and counts from a test run.
type TestFailure ¶
type TestFailure struct {
Name string // test function/case name
Message string // failure output excerpt (stacktrace, assertion)
}
TestFailure holds the details of a single failing test.