reporter

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OutputFormat

type OutputFormat int

OutputFormat specifies the output format for test results.

const (
	// FormatDefault outputs summary only (like go test without -v).
	FormatDefault OutputFormat = iota
	// FormatVerbose outputs detailed test results (like go test -v).
	FormatVerbose
	// FormatJSON outputs JSON test events (like go test -json).
	FormatJSON
)

type Reporter

type Reporter struct {
	// contains filtered or unexported fields
}

Reporter handles formatting and reporting of test results.

func New

func New(out io.Writer) *Reporter

New creates a new Reporter that writes to the given output.

func (*Reporter) SetFormat

func (r *Reporter) SetFormat(format OutputFormat)

SetFormat sets the output format for the reporter.

func (*Reporter) StartSuite

func (r *Reporter) StartSuite(suiteName string) *SuiteReporter

StartSuite reports the start of a test suite.

func (*Reporter) Stats

func (r *Reporter) Stats() (total, passed, failed int)

Stats returns the current test statistics.

func (*Reporter) Summary

func (r *Reporter) Summary() error

Summary prints the final test summary and returns an error if tests failed.

type SuiteReporter added in v0.1.1

type SuiteReporter struct {
	// contains filtered or unexported fields
}

SuiteReporter handles reporting for a specific test suite.

func (*SuiteReporter) End added in v0.1.1

func (s *SuiteReporter) End()

End reports the end of a test suite.

func (*SuiteReporter) ReportFail added in v0.1.1

func (s *SuiteReporter) ReportFail(testName, message string)

ReportFail reports a failing test with a message.

func (*SuiteReporter) ReportPass added in v0.1.1

func (s *SuiteReporter) ReportPass(testName string)

ReportPass reports a passing test.

func (*SuiteReporter) ReportResult added in v0.1.1

func (s *SuiteReporter) ReportResult(testName string, result *evaluator.TestResult)

ReportResult reports a test result from the evaluator.

func (*SuiteReporter) StartTest added in v0.1.1

func (s *SuiteReporter) StartTest(testName string)

StartTest reports the start of an individual test.

type TestEvent

type TestEvent struct {
	Time    time.Time `json:"time"`
	Action  string    `json:"action"`
	Package string    `json:"package,omitempty"`
	Test    string    `json:"test,omitempty"`
	Elapsed float64   `json:"elapsed,omitempty"`
	Output  string    `json:"output,omitempty"`
}

TestEvent represents a JSON test event (similar to go test -json).

Jump to

Keyboard shortcuts

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