testing

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BenchmarkResult

type BenchmarkResult struct {
	Name string `json:"name"`

	Iterations int `json:"iterations"`

	NanosPerOp int64 `json:"nanos_per_op"`

	BytesPerOp int64 `json:"bytes_per_op"`

	AllocsPerOp int64 `json:"allocs_per_op"`

	MemoryUsage int64 `json:"memory_usage"`

	CPUTime time.Duration `json:"cpu_time"`

	WallTime time.Duration `json:"wall_time"`

	GoroutineCount int `json:"goroutine_count"`

	GCPauses []time.Duration `json:"gc_pauses"`

	CustomMetrics map[string]float64 `json:"custom_metrics"`

	Timestamp time.Time `json:"timestamp"`

	GoVersion string `json:"go_version"`

	OS string `json:"os"`

	Architecture string `json:"architecture"`
}

type CPUProfile

type CPUProfile struct {
	UserTime time.Duration `json:"user_time"`

	SystemTime time.Duration `json:"system_time"`

	IdleTime time.Duration `json:"idle_time"`

	CPUPercent float64 `json:"cpu_percent"`

	NumCPU int `json:"num_cpu"`
}

type EnhancedAssert

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

func (*EnhancedAssert) Equal

func (ea *EnhancedAssert) Equal(expected, actual interface{}, msgAndArgs ...interface{}) bool

func (*EnhancedAssert) EventuallyWithContext

func (ea *EnhancedAssert) EventuallyWithContext(ctx context.Context, condition func() bool, timeout, tick time.Duration, msgAndArgs ...interface{}) bool

func (*EnhancedAssert) WithTag

func (ea *EnhancedAssert) WithTag(key, value string) *EnhancedAssert

type Go124TestFramework

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

func NewGo124TestFramework

func NewGo124TestFramework(t *testing.T) *Go124TestFramework

func (*Go124TestFramework) BenchmarkWithMetrics

func (fw *Go124TestFramework) BenchmarkWithMetrics(name string, benchFunc func(*testing.B)) *BenchmarkResult

func (*Go124TestFramework) CreateTempDir

func (fw *Go124TestFramework) CreateTempDir(prefix string) (string, error)

func (*Go124TestFramework) NewEnhancedAssert

func (fw *Go124TestFramework) NewEnhancedAssert(context string) *EnhancedAssert

func (*Go124TestFramework) ParallelTest

func (fw *Go124TestFramework) ParallelTest(testFunc func(*testing.T))

func (*Go124TestFramework) SubTest

func (fw *Go124TestFramework) SubTest(name string, testFunc func(*testing.T)) bool

func (*Go124TestFramework) TableTest

func (fw *Go124TestFramework) TableTest(name string, testCases []TestCase, testFunc func(*testing.T, TestCase))

func (*Go124TestFramework) WriteTestFile

func (fw *Go124TestFramework) WriteTestFile(dir, filename string, content []byte) error

type IsolationLevel

type IsolationLevel string
const (
	IsolationNone IsolationLevel = "none"

	IsolationProcess IsolationLevel = "process"

	IsolationContainer IsolationLevel = "container"

	IsolationNamespace IsolationLevel = "namespace"
)

type MemoryProfile

type MemoryProfile struct {
	HeapAlloc uint64 `json:"heap_alloc"`

	HeapSys uint64 `json:"heap_sys"`

	HeapIdle uint64 `json:"heap_idle"`

	HeapInuse uint64 `json:"heap_inuse"`

	HeapReleased uint64 `json:"heap_released"`

	StackInuse uint64 `json:"stack_inuse"`

	StackSys uint64 `json:"stack_sys"`

	NumGC uint32 `json:"num_gc"`

	GCCPUFraction float64 `json:"gc_cpu_fraction"`

	LastGC time.Time `json:"last_gc"`
}

type ReportFormat

type ReportFormat string
const (
	ReportJSON ReportFormat = "json"

	ReportXML ReportFormat = "xml"

	ReportHTML ReportFormat = "html"

	ReportMarkdown ReportFormat = "markdown"
)

type ResourceLimits

type ResourceLimits struct {
	MaxMemoryMB int64 `json:"max_memory_mb"`

	MaxCPUPercent float64 `json:"max_cpu_percent"`

	MaxDuration time.Duration `json:"max_duration"`

	MaxGoroutines int `json:"max_goroutines"`

	MaxFileHandles int `json:"max_file_handles"`
}

type TestCase

type TestCase struct {
	Name string `json:"name"`

	Input interface{} `json:"input"`

	Expected interface{} `json:"expected"`

	ShouldError bool `json:"should_error"`

	Tags map[string]string `json:"tags"`

	Setup func(*testing.T) `json:"-"`

	Teardown func(*testing.T) `json:"-"`

	Metadata json.RawMessage `json:"metadata"`
}

type TestConfiguration

type TestConfiguration struct {
	Parallel bool `json:"parallel"`

	Timeout time.Duration `json:"timeout"`

	RetryCount int `json:"retry_count"`

	IsolationLevel IsolationLevel `json:"isolation_level"`

	ResourceLimits *ResourceLimits `json:"resource_limits"`

	EnableProfiling bool `json:"enable_profiling"`

	EnableCoverage bool `json:"enable_coverage"`

	ReportFormat ReportFormat `json:"report_format"`

	OutputDirectory string `json:"output_directory"`

	CustomTags map[string]string `json:"custom_tags"`
}

type TestContainer

type TestContainer struct {
	ID string `json:"id"`

	Image string `json:"image"`

	Ports map[int]int `json:"ports"`

	Environment map[string]string `json:"environment"`

	Status string `json:"status"`

	StartTime time.Time `json:"start_time"`
}

type TestMetrics

type TestMetrics struct {
	TotalTests int `json:"total_tests"`

	PassedTests int `json:"passed_tests"`

	FailedTests int `json:"failed_tests"`

	SkippedTests int `json:"skipped_tests"`

	TotalDuration time.Duration `json:"total_duration"`

	AverageDuration time.Duration `json:"average_duration"`

	CoveragePercentage float64 `json:"coverage_percentage"`

	TestResults map[string]*TestResult `json:"test_results"`

	BenchmarkResults map[string]*BenchmarkResult `json:"benchmark_results"`

	MemoryProfile *MemoryProfile `json:"memory_profile"`

	CPUProfile *CPUProfile `json:"cpu_profile"`

	StartTime time.Time `json:"start_time"`

	EndTime time.Time `json:"end_time"`
}

type TestResult

type TestResult struct {
	Name string `json:"name"`

	Status TestStatus `json:"status"`

	Duration time.Duration `json:"duration"`

	ErrorMessage string `json:"error_message,omitempty"`

	StackTrace string `json:"stack_trace,omitempty"`

	AssertionCount int `json:"assertion_count"`

	MemoryUsed int64 `json:"memory_used"`

	GoroutineCount int `json:"goroutine_count"`

	Timestamp time.Time `json:"timestamp"`
}

type TestStatus

type TestStatus string
const (
	TestStatusPassed TestStatus = "passed"

	TestStatusFailed TestStatus = "failed"

	TestStatusSkipped TestStatus = "skipped"

	TestStatusRunning TestStatus = "running"
)

type TestSuiteBase

type TestSuiteBase struct {
	suite.Suite

	Framework *Go124TestFramework
	// contains filtered or unexported fields
}

func (*TestSuiteBase) SetupSuite

func (ts *TestSuiteBase) SetupSuite()

func (*TestSuiteBase) TearDownSuite

func (ts *TestSuiteBase) TearDownSuite()

Directories

Path Synopsis
Package racetest provides comprehensive race condition testing utilities using modern Go concurrency patterns and race detection features
Package racetest provides comprehensive race condition testing utilities using modern Go concurrency patterns and race detection features

Jump to

Keyboard shortcuts

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