Documentation
¶
Overview ¶
Package test provides structured test reporting for AI consumption.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateTestSID ¶
GenerateTestSID generates a stable SID for a test case
Types ¶
type Case ¶
type Case struct {
SID string `json:"sid"`
Suite string `json:"suite"`
Name string `json:"name"`
Status string `json:"status"` // passed|failed|errored|skipped
TimeMs int64 `json:"time_ms"`
TraceSlice []string `json:"trace_slice,omitempty"` // SIDs for failure navigation
Error any `json:"error,omitempty"` // errors.Encoded
}
Case represents a single test case result
type Counts ¶
type Counts struct {
Passed int `json:"passed"`
Failed int `json:"failed"`
Errored int `json:"errored"`
Skipped int `json:"skipped"`
Total int `json:"total"`
}
Counts provides test result statistics
type Platform ¶
type Platform struct {
GoVersion string `json:"go_version"`
OS string `json:"os"`
Arch string `json:"arch"`
Timestamp string `json:"timestamp"`
}
Platform captures environment information for reproducibility
type Report ¶
type Report struct {
Schema string `json:"schema"`
RunID string `json:"run_id"`
Seed *int `json:"seed,omitempty"`
EnvLockDigest string `json:"env_lock_digest,omitempty"`
DurationMs int64 `json:"duration_ms"`
Counts Counts `json:"counts"`
Cases []Case `json:"cases"`
Platform Platform `json:"platform"`
}
Report represents a complete test run report
func EmptyReport ¶
func EmptyReport() *Report
EmptyReport returns a valid empty report (for 0 tests)
func (*Report) SetEnvLockDigest ¶
SetEnvLockDigest sets the environment lock file digest
type TestRunner ¶
type TestRunner struct {
// contains filtered or unexported fields
}
TestRunner provides methods for running and reporting tests
func (*TestRunner) GetReport ¶
func (tr *TestRunner) GetReport() *Report
GetReport finalizes and returns the test report
func (*TestRunner) RunTest ¶
func (tr *TestRunner) RunTest(suite, name string, testFunc func() error)
RunTest executes a test and records the result
func (*TestRunner) Skip ¶
func (tr *TestRunner) Skip(suite, name string, reason string)
Skip marks a test as skipped
Click to show internal directories.
Click to hide internal directories.