Documentation
¶
Index ¶
- type AnalysisReport
- type BenchmarkConfig
- type BenchmarkContext
- type BenchmarkExecutor
- type BenchmarkFunc
- type BenchmarkResult
- type BenchmarkRunner
- func (br *BenchmarkRunner) Add(name string, fn func(*TestContext, *testing.B)) *BenchmarkRunner
- func (br *BenchmarkRunner) Run(b *testing.B)
- func (br *BenchmarkRunner) Setup(fn func(*TestContext) error) *BenchmarkRunner
- func (br *BenchmarkRunner) Teardown(fn func(*TestContext) error) *BenchmarkRunner
- type Call
- type HTTPTestClient
- func (c *HTTPTestClient) Close()
- func (c *HTTPTestClient) Delete(path string, headers map[string]string) (*http.Response, string, error)
- func (c *HTTPTestClient) Get(path string, headers map[string]string) (*http.Response, string, error)
- func (c *HTTPTestClient) Post(path string, body interface{}, headers map[string]string) (*http.Response, string, error)
- func (c *HTTPTestClient) Put(path string, body interface{}, headers map[string]string) (*http.Response, string, error)
- type LatencyTest
- type LoadTest
- type LoadTestConfig
- type LoadTestResult
- type LogEntry
- type MemoryDiff
- type MemoryTracker
- type MetricAnalysis
- type MetricData
- type MetricStats
- type MockCache
- type MockDB
- func (m *MockDB) Clear(table string)
- func (m *MockDB) ClearAll()
- func (m *MockDB) Delete(table string, filter func(map[string]interface{}) bool) int
- func (m *MockDB) Find(table string, filter func(map[string]interface{}) bool) []map[string]interface{}
- func (m *MockDB) FindOne(table string, filter func(map[string]interface{}) bool) map[string]interface{}
- func (m *MockDB) Insert(table string, record map[string]interface{})
- type MockHTTPHandler
- type MockLogger
- func (m *MockLogger) Clear()
- func (m *MockLogger) CountEntries(level string) int
- func (m *MockLogger) Debug(msg string, fields ...interface{})
- func (m *MockLogger) Debugf(format string, args ...interface{})
- func (m *MockLogger) Error(msg string, fields ...interface{})
- func (m *MockLogger) Errorf(format string, args ...interface{})
- func (m *MockLogger) Fatal(msg string, fields ...interface{})
- func (m *MockLogger) Fatalf(format string, args ...interface{})
- func (m *MockLogger) FindEntry(msg string) *LogEntry
- func (m *MockLogger) GetEntries() []LogEntry
- func (m *MockLogger) Info(msg string, fields ...interface{})
- func (m *MockLogger) Infof(format string, args ...interface{})
- func (m *MockLogger) Warn(msg string, fields ...interface{})
- func (m *MockLogger) Warnf(format string, args ...interface{})
- type MockRepository
- type MockService
- type MockValidator
- type PerformanceAnalyzer
- type PerformanceBenchmarkRunner
- type PerformanceContext
- type PerformanceMonitor
- type PerformanceOptimization
- type PerformanceReport
- type PerformanceReportFormat
- type PerformanceSuite
- type PerformanceTestHelper
- func (h *PerformanceTestHelper) CompareResults(a, b *BenchmarkResult) string
- func (h *PerformanceTestHelper) IsRegression(current, baseline *BenchmarkResult, threshold float64) bool
- func (h *PerformanceTestHelper) MeasureDuration(fn func()) time.Duration
- func (h *PerformanceTestHelper) MeasureMemory(fn func()) *MemoryDiff
- func (h *PerformanceTestHelper) MeasureThroughput(fn func(), duration time.Duration) float64
- type PerformanceTestSuite
- type Stage
- type StageResult
- type StressTest
- type StressTestConfig
- type StressTestResult
- type TestConfig
- type TestContext
- func (tc *TestContext) AssertContains(s, substr string, msg string)
- func (tc *TestContext) AssertEqual(expected, actual interface{}, msg string)
- func (tc *TestContext) AssertError(err error, msg string)
- func (tc *TestContext) AssertFalse(value bool, msg string)
- func (tc *TestContext) AssertLen(value interface{}, expected int, msg string)
- func (tc *TestContext) AssertNil(value interface{}, msg string)
- func (tc *TestContext) AssertNoError(err error, msg string)
- func (tc *TestContext) AssertNotEqual(expected, actual interface{}, msg string)
- func (tc *TestContext) AssertNotNil(value interface{}, msg string)
- func (tc *TestContext) AssertTrue(value bool, msg string)
- func (tc *TestContext) Cleanup()
- func (tc *TestContext) Context() context.Context
- func (tc *TestContext) Get(name string) interface{}
- func (tc *TestContext) MustGet(name string) interface{}
- func (tc *TestContext) Set(name string, component interface{})
- type TestHelper
- func (h *TestHelper) CaptureOutput(fn func()) (stdout, stderr string)
- func (h *TestHelper) Diff(a, b string) string
- func (h *TestHelper) Eventually(fn func() bool, timeout time.Duration, interval time.Duration) error
- func (h *TestHelper) JSONEquals(a, b string) bool
- func (h *TestHelper) Retry(fn func() error, maxAttempts int, delay time.Duration) error
- func (h *TestHelper) TempDir() (string, func())
- func (h *TestHelper) TempFile(content string) (*os.File, func())
- type TestReporter
- type TestResult
- type TestRunner
- type TestRunnerV2
- type TestSuite
- type ThroughputTest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnalysisReport ¶
type AnalysisReport struct {
Analyses map[string]*MetricAnalysis
}
AnalysisReport represents an analysis report
type BenchmarkConfig ¶
type BenchmarkConfig struct {
Iterations int
Duration time.Duration
Warmup int
CPUProfile bool
MemProfile bool
}
BenchmarkConfig represents benchmark configuration
func DefaultBenchmarkConfig ¶
func DefaultBenchmarkConfig() BenchmarkConfig
DefaultBenchmarkConfig creates a default benchmark configuration
type BenchmarkContext ¶
type BenchmarkContext struct {
// contains filtered or unexported fields
}
BenchmarkContext provides context for benchmarks
func NewBenchmarkContext ¶
func NewBenchmarkContext() *BenchmarkContext
NewBenchmarkContext creates a new benchmark context
func (*BenchmarkContext) Increment ¶
func (bc *BenchmarkContext) Increment()
Increment increments iteration count
func (*BenchmarkContext) Iterations ¶
func (bc *BenchmarkContext) Iterations() int64
Iterations returns the iteration count
type BenchmarkExecutor ¶
type BenchmarkExecutor struct {
// contains filtered or unexported fields
}
BenchmarkExecutor executes benchmarks with configuration
func NewBenchmarkExecutor ¶
func NewBenchmarkExecutor(config BenchmarkConfig) *BenchmarkExecutor
NewBenchmarkExecutor creates a new benchmark executor
func (*BenchmarkExecutor) Execute ¶
func (be *BenchmarkExecutor) Execute(name string, fn func() error) *BenchmarkResult
Execute executes a benchmark
type BenchmarkFunc ¶
type BenchmarkFunc func() error
BenchmarkFunc is a function that can be benchmarked
type BenchmarkResult ¶
type BenchmarkResult struct {
Name string
Duration time.Duration
Operations int64
Bytes int64
Allocations int64
Memory uint64
Extra map[string]interface{}
}
BenchmarkResult represents a benchmark result
func Measure ¶
func Measure(fn BenchmarkFunc, iterations int) *BenchmarkResult
Measure measures a function
func (*BenchmarkResult) Latency ¶
func (br *BenchmarkResult) Latency() time.Duration
Latency returns average latency per operation
func (*BenchmarkResult) MemoryPerOp ¶
func (br *BenchmarkResult) MemoryPerOp() float64
MemoryPerOp returns memory allocated per operation
func (*BenchmarkResult) String ¶
func (br *BenchmarkResult) String() string
String returns a string representation
func (*BenchmarkResult) Throughput ¶
func (br *BenchmarkResult) Throughput() float64
Throughput returns operations per second
type BenchmarkRunner ¶
type BenchmarkRunner struct {
// contains filtered or unexported fields
}
BenchmarkRunner runs benchmarks with setup and teardown
func NewBenchmarkRunner ¶
func NewBenchmarkRunner() *BenchmarkRunner
NewBenchmarkRunner creates a new benchmark runner
func (*BenchmarkRunner) Add ¶
func (br *BenchmarkRunner) Add(name string, fn func(*TestContext, *testing.B)) *BenchmarkRunner
Add adds a benchmark
func (*BenchmarkRunner) Setup ¶
func (br *BenchmarkRunner) Setup(fn func(*TestContext) error) *BenchmarkRunner
Setup sets up the benchmark runner
func (*BenchmarkRunner) Teardown ¶
func (br *BenchmarkRunner) Teardown(fn func(*TestContext) error) *BenchmarkRunner
Teardown sets up the teardown
type HTTPTestClient ¶
type HTTPTestClient struct {
// contains filtered or unexported fields
}
HTTPTestClient is a test HTTP client
func NewHTTPTestClient ¶
func NewHTTPTestClient(handler http.Handler) *HTTPTestClient
NewHTTPTestClient creates a new HTTP test client
func (*HTTPTestClient) Delete ¶
func (c *HTTPTestClient) Delete(path string, headers map[string]string) (*http.Response, string, error)
Delete makes a DELETE request
func (*HTTPTestClient) Get ¶
func (c *HTTPTestClient) Get(path string, headers map[string]string) (*http.Response, string, error)
Get makes a GET request
type LatencyTest ¶
type LatencyTest struct {
// contains filtered or unexported fields
}
LatencyTest measures latency
func NewLatencyTest ¶
func NewLatencyTest(iterations int, workload func() error) *LatencyTest
NewLatencyTest creates a new latency test
func (*LatencyTest) Run ¶
func (lt *LatencyTest) Run() *BenchmarkResult
Run executes the latency test
type LoadTest ¶
type LoadTest struct {
// contains filtered or unexported fields
}
LoadTest runs a load test
func NewLoadTest ¶
func NewLoadTest(config LoadTestConfig, workload func() error) *LoadTest
NewLoadTest creates a new load test
type LoadTestConfig ¶
type LoadTestConfig struct {
Concurrency int
TotalRequests int64
Duration time.Duration
RampUp time.Duration
TargetRPS float64
}
LoadTestConfig represents load test configuration
func DefaultLoadTestConfig ¶
func DefaultLoadTestConfig() LoadTestConfig
DefaultLoadTestConfig creates a default load test configuration
type LoadTestResult ¶
type LoadTestResult struct {
Config LoadTestConfig
TotalRequests int64
Successful int64
Failed int64
TotalDuration time.Duration
AverageLatency time.Duration
MinLatency time.Duration
MaxLatency time.Duration
RequestsPerSec float64
StatusCodes map[int]int64
Errors []string
}
LoadTestResult represents a load test result
func (*LoadTestResult) String ¶
func (lr *LoadTestResult) String() string
String returns a string representation
type MemoryDiff ¶
type MemoryDiff struct {
Alloc uint64
TotalAlloc uint64
Mallocs uint64
Frees uint64
HeapAlloc uint64
HeapInuse uint64
StackInuse uint64
NumGC uint32
}
MemoryDiff represents memory differences
func (*MemoryDiff) String ¶
func (md *MemoryDiff) String() string
String returns a string representation
type MemoryTracker ¶
type MemoryTracker struct {
// contains filtered or unexported fields
}
MemoryTracker tracks memory usage
func NewMemoryTracker ¶
func NewMemoryTracker() *MemoryTracker
NewMemoryTracker creates a new memory tracker
func (*MemoryTracker) Stop ¶
func (mt *MemoryTracker) Stop() *MemoryDiff
Stop stops tracking and returns diff
type MetricAnalysis ¶
type MetricAnalysis struct {
Name string
Throughput float64
Latency time.Duration
Operations int64
Memory uint64
Allocations int64
Level string
}
MetricAnalysis represents analysis for a metric
func (*MetricAnalysis) String ¶
func (ma *MetricAnalysis) String() string
String returns a string representation
type MetricData ¶
MetricData holds metric data
type MetricStats ¶
type MetricStats struct {
Name string
Count int64
Sum float64
Average float64
Min float64
Max float64
}
MetricStats represents statistics for a metric
func (*MetricStats) String ¶
func (ms *MetricStats) String() string
String returns a string representation
type MockCache ¶
type MockCache struct {
// contains filtered or unexported fields
}
MockCache is a mock cache for testing
type MockDB ¶
type MockDB struct {
// contains filtered or unexported fields
}
MockDB is a mock database for testing
func (*MockDB) Find ¶
func (m *MockDB) Find(table string, filter func(map[string]interface{}) bool) []map[string]interface{}
Find finds records
type MockHTTPHandler ¶
type MockHTTPHandler struct {
// contains filtered or unexported fields
}
MockHTTPHandler is a mock HTTP handler for testing
func NewMockHTTPHandler ¶
func NewMockHTTPHandler() *MockHTTPHandler
NewMockHTTPHandler creates a new mock HTTP handler
func (*MockHTTPHandler) GetRequests ¶
func (m *MockHTTPHandler) GetRequests() []*http.Request
GetRequests returns all requests
func (*MockHTTPHandler) ServeHTTP ¶
func (m *MockHTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler
func (*MockHTTPHandler) SetResponse ¶
func (m *MockHTTPHandler) SetResponse(status int, body string, headers map[string]string)
SetResponse sets the response
type MockLogger ¶
type MockLogger struct {
// contains filtered or unexported fields
}
MockLogger is a mock logger for testing
func (*MockLogger) CountEntries ¶
func (m *MockLogger) CountEntries(level string) int
CountEntries counts entries with a level
func (*MockLogger) Debug ¶
func (m *MockLogger) Debug(msg string, fields ...interface{})
Debug logs debug level
func (*MockLogger) Debugf ¶
func (m *MockLogger) Debugf(format string, args ...interface{})
Debugf logs debug level with format
func (*MockLogger) Error ¶
func (m *MockLogger) Error(msg string, fields ...interface{})
Error logs error level
func (*MockLogger) Errorf ¶
func (m *MockLogger) Errorf(format string, args ...interface{})
Errorf logs error level with format
func (*MockLogger) Fatal ¶
func (m *MockLogger) Fatal(msg string, fields ...interface{})
Fatal logs fatal level
func (*MockLogger) Fatalf ¶
func (m *MockLogger) Fatalf(format string, args ...interface{})
Fatalf logs fatal level with format
func (*MockLogger) FindEntry ¶
func (m *MockLogger) FindEntry(msg string) *LogEntry
FindEntry finds an entry by message
func (*MockLogger) GetEntries ¶
func (m *MockLogger) GetEntries() []LogEntry
GetEntries returns all log entries
func (*MockLogger) Info ¶
func (m *MockLogger) Info(msg string, fields ...interface{})
Info logs info level
func (*MockLogger) Infof ¶
func (m *MockLogger) Infof(format string, args ...interface{})
Infof logs info level with format
func (*MockLogger) Warn ¶
func (m *MockLogger) Warn(msg string, fields ...interface{})
Warn logs warn level
func (*MockLogger) Warnf ¶
func (m *MockLogger) Warnf(format string, args ...interface{})
Warnf logs warn level with format
type MockRepository ¶
type MockRepository struct {
// contains filtered or unexported fields
}
MockRepository is a mock repository for testing
func NewMockRepository ¶
func NewMockRepository() *MockRepository
NewMockRepository creates a new mock repository
func (*MockRepository) Set ¶
func (m *MockRepository) Set(key string, value interface{})
Set sets a value
type MockService ¶
type MockService struct {
// contains filtered or unexported fields
}
MockService is a mock service for testing
func (*MockService) Call ¶
func (m *MockService) Call(method string, args ...interface{}) (interface{}, error)
Call records a call
func (*MockService) GetCall ¶
func (m *MockService) GetCall(index int) *Call
GetCall gets a specific call
type MockValidator ¶
type MockValidator struct {
// contains filtered or unexported fields
}
MockValidator is a mock validator for testing
func NewMockValidator ¶
func NewMockValidator() *MockValidator
NewMockValidator creates a new mock validator
func (*MockValidator) SetError ¶
func (m *MockValidator) SetError(key string, err error)
SetError sets an error for a key
func (*MockValidator) Validate ¶
func (m *MockValidator) Validate(key string, value interface{}) error
Validate validates a value
type PerformanceAnalyzer ¶
type PerformanceAnalyzer struct {
// contains filtered or unexported fields
}
PerformanceAnalyzer analyzes performance results
func NewPerformanceAnalyzer ¶
func NewPerformanceAnalyzer(results map[string]*BenchmarkResult) *PerformanceAnalyzer
NewPerformanceAnalyzer creates a new performance analyzer
func (*PerformanceAnalyzer) Analyze ¶
func (pa *PerformanceAnalyzer) Analyze() *AnalysisReport
Analyze analyzes the results
func (*PerformanceAnalyzer) GetOptimizations ¶
func (pa *PerformanceAnalyzer) GetOptimizations() []PerformanceOptimization
GetOptimizations gets optimization suggestions
type PerformanceBenchmarkRunner ¶
type PerformanceBenchmarkRunner struct {
// contains filtered or unexported fields
}
PerformanceBenchmarkRunner runs benchmarks
func NewPerformanceBenchmarkRunner ¶
func NewPerformanceBenchmarkRunner() *PerformanceBenchmarkRunner
NewPerformanceBenchmarkRunner creates a new benchmark runner
func (*PerformanceBenchmarkRunner) Add ¶
func (br *PerformanceBenchmarkRunner) Add(name string, fn func(*BenchmarkContext) *BenchmarkResult) *PerformanceBenchmarkRunner
Add adds a benchmark
func (*PerformanceBenchmarkRunner) Run ¶
func (br *PerformanceBenchmarkRunner) Run() map[string]*BenchmarkResult
Run runs all benchmarks
type PerformanceContext ¶
type PerformanceContext struct {
// contains filtered or unexported fields
}
PerformanceContext provides context for performance tests
func NewPerformanceContext ¶
func NewPerformanceContext() *PerformanceContext
NewPerformanceContext creates a new performance context
func (*PerformanceContext) Context ¶
func (pc *PerformanceContext) Context() context.Context
Context returns the context
func (*PerformanceContext) Elapsed ¶
func (pc *PerformanceContext) Elapsed() time.Duration
Elapsed returns elapsed time
func (*PerformanceContext) GetMetric ¶
func (pc *PerformanceContext) GetMetric(key string) interface{}
GetMetric gets a metric
func (*PerformanceContext) SetMetric ¶
func (pc *PerformanceContext) SetMetric(key string, value interface{})
SetMetric sets a metric
type PerformanceMonitor ¶
type PerformanceMonitor struct {
// contains filtered or unexported fields
}
PerformanceMonitor monitors performance metrics
func NewPerformanceMonitor ¶
func NewPerformanceMonitor() *PerformanceMonitor
NewPerformanceMonitor creates a new performance monitor
func (*PerformanceMonitor) GetAllStats ¶
func (pm *PerformanceMonitor) GetAllStats() map[string]*MetricStats
GetAllStats gets all statistics
func (*PerformanceMonitor) GetStats ¶
func (pm *PerformanceMonitor) GetStats(name string) *MetricStats
GetStats gets statistics for a metric
func (*PerformanceMonitor) Record ¶
func (pm *PerformanceMonitor) Record(name string, value float64)
Record records a metric value
type PerformanceOptimization ¶
type PerformanceOptimization struct {
Metric string
Current string
Suggestion string
Priority string
}
PerformanceOptimization represents optimization suggestions
type PerformanceReport ¶
type PerformanceReport struct {
// contains filtered or unexported fields
}
PerformanceReport generates performance reports
func NewPerformanceReport ¶
func NewPerformanceReport(results map[string]*BenchmarkResult) *PerformanceReport
NewPerformanceReport creates a new performance report
func (*PerformanceReport) Compare ¶
func (pr *PerformanceReport) Compare(other *PerformanceReport) string
Compare compares two sets of results
func (*PerformanceReport) Generate ¶
func (pr *PerformanceReport) Generate() string
Generate generates a report string
type PerformanceReportFormat ¶
type PerformanceReportFormat struct{}
PerformanceReportFormat formats performance reports
func NewPerformanceReportFormat ¶
func NewPerformanceReportFormat() *PerformanceReportFormat
NewPerformanceReportFormat creates a new performance report formatter
func (*PerformanceReportFormat) ToCSV ¶
func (f *PerformanceReportFormat) ToCSV(results map[string]*BenchmarkResult) string
ToCSV converts results to CSV
func (*PerformanceReportFormat) ToJSON ¶
func (f *PerformanceReportFormat) ToJSON(results map[string]*BenchmarkResult) string
ToJSON converts results to JSON
func (*PerformanceReportFormat) ToMarkdown ¶
func (f *PerformanceReportFormat) ToMarkdown(results map[string]*BenchmarkResult) string
ToMarkdown converts results to Markdown
type PerformanceSuite ¶
type PerformanceSuite struct {
// contains filtered or unexported fields
}
PerformanceSuite is a collection of performance tests
func NewPerformanceSuite ¶
func NewPerformanceSuite(name string) *PerformanceSuite
NewPerformanceSuite creates a new performance suite
func (*PerformanceSuite) Add ¶
func (ps *PerformanceSuite) Add(name string, fn func() *BenchmarkResult) *PerformanceSuite
Add adds a test to the suite
func (*PerformanceSuite) Run ¶
func (ps *PerformanceSuite) Run() map[string]*BenchmarkResult
Run runs all tests in the suite
type PerformanceTestHelper ¶
type PerformanceTestHelper struct{}
PerformanceTestHelper provides helper methods for performance testing
func NewPerformanceTestHelper ¶
func NewPerformanceTestHelper() *PerformanceTestHelper
NewPerformanceTestHelper creates a new performance test helper
func (*PerformanceTestHelper) CompareResults ¶
func (h *PerformanceTestHelper) CompareResults(a, b *BenchmarkResult) string
CompareResults compares two benchmark results
func (*PerformanceTestHelper) IsRegression ¶
func (h *PerformanceTestHelper) IsRegression(current, baseline *BenchmarkResult, threshold float64) bool
IsRegression checks if there's a performance regression
func (*PerformanceTestHelper) MeasureDuration ¶
func (h *PerformanceTestHelper) MeasureDuration(fn func()) time.Duration
MeasureDuration measures duration of a function
func (*PerformanceTestHelper) MeasureMemory ¶
func (h *PerformanceTestHelper) MeasureMemory(fn func()) *MemoryDiff
MeasureMemory measures memory usage of a function
func (*PerformanceTestHelper) MeasureThroughput ¶
func (h *PerformanceTestHelper) MeasureThroughput(fn func(), duration time.Duration) float64
MeasureThroughput measures throughput of a function
type PerformanceTestSuite ¶
type PerformanceTestSuite struct {
// contains filtered or unexported fields
}
PerformanceTestSuite is a suite for performance testing
func NewPerformanceTestSuite ¶
func NewPerformanceTestSuite(name string) *PerformanceTestSuite
NewPerformanceTestSuite creates a new performance test suite
func (*PerformanceTestSuite) Add ¶
func (ps *PerformanceTestSuite) Add(name string, fn func(*PerformanceContext) *BenchmarkResult) *PerformanceTestSuite
Add adds a benchmark to the suite
func (*PerformanceTestSuite) Run ¶
func (ps *PerformanceTestSuite) Run() map[string]*BenchmarkResult
Run runs all benchmarks in the suite
type StageResult ¶
type StageResult struct {
Stage
LoadTestResult *LoadTestResult
}
StageResult represents a stage result
type StressTest ¶
type StressTest struct {
// contains filtered or unexported fields
}
StressTest runs a stress test
func NewStressTest ¶
func NewStressTest(config StressTestConfig, workload func() error) *StressTest
NewStressTest creates a new stress test
type StressTestConfig ¶
type StressTestConfig struct {
Stages []Stage
}
StressTestConfig represents stress test configuration
type StressTestResult ¶
type StressTestResult struct {
Stages []StageResult
}
StressTestResult represents a stress test result
type TestConfig ¶
type TestConfig struct {
Timeout time.Duration
RetryCount int
RetryDelay time.Duration
Verbose bool
}
TestConfig holds test configuration
func DefaultTestConfig ¶
func DefaultTestConfig() TestConfig
DefaultTestConfig creates a default test configuration
type TestContext ¶
type TestContext struct {
// contains filtered or unexported fields
}
TestContext holds test context and utilities
func NewTestContext ¶
func NewTestContext(t *testing.T) *TestContext
NewTestContext creates a new test context
func (*TestContext) AssertContains ¶
func (tc *TestContext) AssertContains(s, substr string, msg string)
AssertContains asserts string contains substring
func (*TestContext) AssertEqual ¶
func (tc *TestContext) AssertEqual(expected, actual interface{}, msg string)
AssertEqual asserts two values are equal
func (*TestContext) AssertError ¶
func (tc *TestContext) AssertError(err error, msg string)
AssertError asserts error is not nil
func (*TestContext) AssertFalse ¶
func (tc *TestContext) AssertFalse(value bool, msg string)
AssertFalse asserts value is false
func (*TestContext) AssertLen ¶
func (tc *TestContext) AssertLen(value interface{}, expected int, msg string)
AssertLen asserts length
func (*TestContext) AssertNil ¶
func (tc *TestContext) AssertNil(value interface{}, msg string)
AssertNil asserts value is nil
func (*TestContext) AssertNoError ¶
func (tc *TestContext) AssertNoError(err error, msg string)
AssertNoError asserts error is nil
func (*TestContext) AssertNotEqual ¶
func (tc *TestContext) AssertNotEqual(expected, actual interface{}, msg string)
AssertNotEqual asserts two values are not equal
func (*TestContext) AssertNotNil ¶
func (tc *TestContext) AssertNotNil(value interface{}, msg string)
AssertNotNil asserts value is not nil
func (*TestContext) AssertTrue ¶
func (tc *TestContext) AssertTrue(value bool, msg string)
AssertTrue asserts value is true
func (*TestContext) Context ¶
func (tc *TestContext) Context() context.Context
Context returns the context
func (*TestContext) Get ¶
func (tc *TestContext) Get(name string) interface{}
Get retrieves a component
func (*TestContext) MustGet ¶
func (tc *TestContext) MustGet(name string) interface{}
MustGet retrieves a component or fails the test
func (*TestContext) Set ¶
func (tc *TestContext) Set(name string, component interface{})
Set stores a component
type TestHelper ¶
type TestHelper struct{}
TestHelper provides common test helpers
func (*TestHelper) CaptureOutput ¶
func (h *TestHelper) CaptureOutput(fn func()) (stdout, stderr string)
CaptureOutput captures stdout/stderr
func (*TestHelper) Diff ¶
func (h *TestHelper) Diff(a, b string) string
Diff returns the difference between two JSON strings
func (*TestHelper) Eventually ¶
func (h *TestHelper) Eventually(fn func() bool, timeout time.Duration, interval time.Duration) error
Eventually waits for a condition to be true
func (*TestHelper) JSONEquals ¶
func (h *TestHelper) JSONEquals(a, b string) bool
JSONEquals compares two JSON strings
func (*TestHelper) TempDir ¶
func (h *TestHelper) TempDir() (string, func())
TempDir creates a temporary directory
type TestReporter ¶
type TestReporter struct {
// contains filtered or unexported fields
}
TestReporter is a custom test reporter
func NewTestReporter ¶
func NewTestReporter() *TestReporter
NewTestReporter creates a new test reporter
func (*TestReporter) GetResults ¶
func (tr *TestReporter) GetResults() []TestResult
GetResults returns all results
func (*TestReporter) Summary ¶
func (tr *TestReporter) Summary() (passed, failed int)
Summary returns a summary
type TestResult ¶
TestResult represents a test result
type TestRunner ¶
type TestRunner struct {
// contains filtered or unexported fields
}
TestRunner runs tests with setup and teardown
func (*TestRunner) Add ¶
func (tr *TestRunner) Add(name string, fn func(*TestContext)) *TestRunner
Add adds a test
func (*TestRunner) Setup ¶
func (tr *TestRunner) Setup(fn func(*TestContext) error) *TestRunner
Setup sets up the test runner
func (*TestRunner) Teardown ¶
func (tr *TestRunner) Teardown(fn func(*TestContext) error) *TestRunner
Teardown sets up the teardown
type TestRunnerV2 ¶
type TestRunnerV2 struct {
// contains filtered or unexported fields
}
TestRunnerV2 runs tests with configuration
func NewTestRunnerV2 ¶
func NewTestRunnerV2(config TestConfig) *TestRunnerV2
NewTestRunnerV2 creates a new test runner v2
func (*TestRunnerV2) Add ¶
func (tr *TestRunnerV2) Add(name string, fn func(*TestContext) error) *TestRunnerV2
Add adds a test
type TestSuite ¶
type TestSuite struct {
// contains filtered or unexported fields
}
TestSuite is a collection of tests
type ThroughputTest ¶
type ThroughputTest struct {
// contains filtered or unexported fields
}
ThroughputTest measures throughput
func NewThroughputTest ¶
func NewThroughputTest(duration time.Duration, workload func()) *ThroughputTest
NewThroughputTest creates a new throughput test
func (*ThroughputTest) Run ¶
func (tt *ThroughputTest) Run() *BenchmarkResult
Run executes the throughput test