Documentation
¶
Overview ¶
Package report turns a test runner's output into typed failures.
This is the difference between an agent that fixes its own test and one that flails. Handed raw stdout, a model has to guess at the format, and it guesses differently each time; handed {file, line, message} it can open the file and edit the line.
There is no cross-language standard for this, and it is worth being blunt that there isn't. JUnit XML is a de facto format with real dialect drift -- pytest ships a junit_family setting precisely because implementations disagree -- and the native JSON formats are each single-ecosystem. So the approach is one small internal shape plus a parser per format, built against output captured from the real runners rather than from documentation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Failure ¶
type Failure struct {
// Name is the test's name, as the runner reports it.
Name string `json:"name"`
// Suite is the enclosing class, file, or package.
Suite string `json:"suite,omitempty"`
// File and Line locate the failure. Empty when the runner does not say
// and the message does not reveal it; never guessed.
File string `json:"file,omitempty"`
Line int `json:"line,omitempty"`
// Message is the assertion message, trimmed to something an agent can read
// without a full stack trace.
Message string `json:"message"`
// Output is the untruncated failure text, when it differs from Message.
Output string `json:"output,omitempty"`
}
Failure is one failing test, located.
type Result ¶
type Result struct {
Total int `json:"total"`
Passed int `json:"passed"`
Failed int `json:"failed"`
Skipped int `json:"skipped"`
Duration time.Duration `json:"duration_ms"`
Failures []Failure `json:"failures"`
}
Result is a parsed test run.
func ParseGoJSON ¶
ParseGoJSON reads the newline-delimited event stream from `go test -json`.
It is a stream rather than a report file, which is why it is parsed incrementally: a long suite reports progress as it goes instead of only at the end.
func ParseJUnit ¶
ParseJUnit reads JUnit XML, tolerating the dialects real runners emit.