Documentation
¶
Index ¶
- func ExecuteGrpcWithRetry(ctx context.Context, cfg config.AutoTestConfig, operation func() error) error
- func ExecuteHttpWithRetry(ctx context.Context, cfg config.AutoTestConfig, operation func() error) error
- func IsRetryableStatusCode(statusCode int, retryCodes []int) bool
- func MD5(data string) string
- func WriterCSV(path string, records [][]string)
- type Attachment
- type Cache
- type CacheItem
- type CacheManager
- type EnvironmentManager
- func (em *EnvironmentManager) ExportToFile(filePath string) error
- func (em *EnvironmentManager) GetAllVariables() map[string]string
- func (em *EnvironmentManager) GetAllVars() map[string]string
- func (em *EnvironmentManager) GetVariable(key string) (string, bool)
- func (em *EnvironmentManager) ListAvailableEnvironments() []string
- func (em *EnvironmentManager) LoadEnvironment(envName string) error
- func (em *EnvironmentManager) LoadFromFile(filePath string) error
- func (em *EnvironmentManager) SetVariable(key, value string)
- func (em *EnvironmentManager) ValidateEnvironment(envName string) error
- type Field
- type JUnitError
- type JUnitFailure
- type JUnitSkipped
- type JUnitTestCase
- type JUnitTestSuite
- type NotificationService
- type RateLimiter
- type ReportData
- type ReportGenerator
- type RetryableHTTPClient
- type SlackMessage
- type TestCaseResult
- type TestResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteGrpcWithRetry ¶ added in v0.2.1
func ExecuteGrpcWithRetry(ctx context.Context, cfg config.AutoTestConfig, operation func() error) error
ExecuteGrpcWithRetry 执行gRPC请求并支持重试
func ExecuteHttpWithRetry ¶ added in v0.2.1
func ExecuteHttpWithRetry(ctx context.Context, cfg config.AutoTestConfig, operation func() error) error
ExecuteHttpWithRetry 执行HTTP请求并支持重试
func IsRetryableStatusCode ¶ added in v0.2.1
IsRetryableStatusCode 检查状态码是否需要重试
Types ¶
type Attachment ¶ added in v0.2.1
type Attachment struct {
Color string `json:"color"`
Title string `json:"title"`
Fields []Field `json:"fields"`
}
Attachment Slack附件
type Cache ¶ added in v0.2.1
type Cache struct {
// contains filtered or unexported fields
}
Cache 通用缓存
type CacheManager ¶ added in v0.2.1
type CacheManager struct {
// 只保留真正有价值的缓存
GrpcDescriptorCache *Cache // gRPC描述符缓存
}
CacheManager 缓存管理器
func NewCacheManager ¶ added in v0.2.1
func NewCacheManager(cfg config.AutoTestConfig) *CacheManager
NewCacheManager 创建缓存管理器
func (*CacheManager) GetStats ¶ added in v0.2.1
func (cm *CacheManager) GetStats() map[string]map[string]interface{}
GetStats 获取缓存的统计信息
type EnvironmentManager ¶ added in v0.2.1
type EnvironmentManager struct {
// contains filtered or unexported fields
}
EnvironmentManager 环境管理器
func NewEnvironmentManager ¶ added in v0.2.1
func NewEnvironmentManager(cfg config.AutoTestConfig) *EnvironmentManager
NewEnvironmentManager 创建环境管理器
func (*EnvironmentManager) ExportToFile ¶ added in v0.2.1
func (em *EnvironmentManager) ExportToFile(filePath string) error
ExportToFile 导出环境变量到文件
func (*EnvironmentManager) GetAllVariables ¶ added in v0.2.1
func (em *EnvironmentManager) GetAllVariables() map[string]string
GetAllVariables 获取所有环境变量
func (*EnvironmentManager) GetAllVars ¶ added in v0.2.1
func (em *EnvironmentManager) GetAllVars() map[string]string
GetAllVars 获取所有环境变量
func (*EnvironmentManager) GetVariable ¶ added in v0.2.1
func (em *EnvironmentManager) GetVariable(key string) (string, bool)
GetVariable 获取环境变量
func (*EnvironmentManager) ListAvailableEnvironments ¶ added in v0.2.1
func (em *EnvironmentManager) ListAvailableEnvironments() []string
ListAvailableEnvironments 列出可用的环境
func (*EnvironmentManager) LoadEnvironment ¶ added in v0.2.1
func (em *EnvironmentManager) LoadEnvironment(envName string) error
LoadEnvironment 加载指定环境的配置
func (*EnvironmentManager) LoadFromFile ¶ added in v0.2.1
func (em *EnvironmentManager) LoadFromFile(filePath string) error
LoadFromFile 从文件加载环境变量
func (*EnvironmentManager) SetVariable ¶ added in v0.2.1
func (em *EnvironmentManager) SetVariable(key, value string)
SetVariable 设置环境变量
func (*EnvironmentManager) ValidateEnvironment ¶ added in v0.2.1
func (em *EnvironmentManager) ValidateEnvironment(envName string) error
ValidateEnvironment 验证环境配置
type Field ¶ added in v0.2.1
type Field struct {
Title string `json:"title"`
Value string `json:"value"`
Short bool `json:"short"`
}
Field Slack字段
type JUnitError ¶ added in v0.2.1
type JUnitError struct {
Message string `xml:"message,attr"`
Type string `xml:"type,attr"`
Content string `xml:",chardata"`
}
JUnitError JUnit错误信息
type JUnitFailure ¶ added in v0.2.1
type JUnitFailure struct {
Message string `xml:"message,attr"`
Type string `xml:"type,attr"`
Content string `xml:",chardata"`
}
JUnitFailure JUnit失败信息
type JUnitSkipped ¶ added in v0.2.1
type JUnitSkipped struct {
Message string `xml:"message,attr"`
}
JUnitSkipped JUnit跳过信息
type JUnitTestCase ¶ added in v0.2.1
type JUnitTestCase struct {
Name string `xml:"name,attr"`
ClassName string `xml:"classname,attr"`
Time float64 `xml:"time,attr"`
Failure *JUnitFailure `xml:"failure,omitempty"`
Error *JUnitError `xml:"error,omitempty"`
Skipped *JUnitSkipped `xml:"skipped,omitempty"`
}
JUnitTestCase JUnit测试用例
type JUnitTestSuite ¶ added in v0.2.1
type JUnitTestSuite struct {
XMLName xml.Name `xml:"testsuite"`
Name string `xml:"name,attr"`
Tests int `xml:"tests,attr"`
Failures int `xml:"failures,attr"`
Errors int `xml:"errors,attr"`
Skipped int `xml:"skipped,attr"`
Time float64 `xml:"time,attr"`
Timestamp string `xml:"timestamp,attr"`
TestCases []JUnitTestCase `xml:"testcase"`
}
JUnitTestSuite JUnit XML格式
type NotificationService ¶ added in v0.2.1
type NotificationService struct {
// contains filtered or unexported fields
}
NotificationService 通知服务
func NewNotificationService ¶ added in v0.2.1
func NewNotificationService(cfg config.AutoTestConfig) *NotificationService
NewNotificationService 创建通知服务
func (*NotificationService) SendTestResult ¶ added in v0.2.1
func (ns *NotificationService) SendTestResult(result TestResult) error
SendTestResult 发送测试结果通知
type RateLimiter ¶ added in v0.2.1
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter 限流器
func NewRateLimiter ¶ added in v0.2.1
func NewRateLimiter(maxConcurrent int, ratePerSecond int) *RateLimiter
NewRateLimiter 创建限流器
func (*RateLimiter) Acquire ¶ added in v0.2.1
func (rl *RateLimiter) Acquire(ctx context.Context) error
Acquire 获取执行权限
func (*RateLimiter) ExecuteWithLimit ¶ added in v0.2.1
func (rl *RateLimiter) ExecuteWithLimit(ctx context.Context, fn func() error) error
ExecuteWithLimit 在限流控制下执行函数
type ReportData ¶ added in v0.2.1
type ReportData struct {
Summary struct {
TotalTests int `json:"total_tests"`
PassedTests int `json:"passed_tests"`
FailedTests int `json:"failed_tests"`
SkippedTests int `json:"skipped_tests"`
Duration time.Duration `json:"duration"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
PassRate float64 `json:"pass_rate"`
} `json:"summary"`
TestCases []TestCaseResult `json:"test_cases"`
}
ReportData 报告数据
type ReportGenerator ¶ added in v0.2.1
type ReportGenerator struct {
// contains filtered or unexported fields
}
ReportGenerator 报告生成器
func NewReportGenerator ¶ added in v0.2.1
func NewReportGenerator(cfg config.AutoTestConfig) *ReportGenerator
NewReportGenerator 创建报告生成器
func (*ReportGenerator) GenerateReports ¶ added in v0.2.1
func (rg *ReportGenerator) GenerateReports(data ReportData) error
GenerateReports 生成所有格式的报告
type RetryableHTTPClient ¶ added in v0.2.1
type RetryableHTTPClient struct {
// contains filtered or unexported fields
}
RetryableHTTPClient 支持重试的HTTP客户端
func NewRetryableHTTPClient ¶ added in v0.2.1
func NewRetryableHTTPClient(client *resty.Client, cfg config.AutoTestConfig) *RetryableHTTPClient
NewRetryableHTTPClient 创建支持重试的HTTP客户端
func (*RetryableHTTPClient) ExecuteWithRetry ¶ added in v0.2.1
ExecuteWithRetry 执行HTTP请求并支持重试
type SlackMessage ¶ added in v0.2.1
type SlackMessage struct {
Text string `json:"text"`
Attachments []Attachment `json:"attachments,omitempty"`
}
SlackMessage Slack消息格式
type TestCaseResult ¶ added in v0.2.1
type TestCaseResult struct {
ID uint64 `json:"id"`
Description string `json:"description"`
Status string `json:"status"`
Duration time.Duration `json:"duration"`
ErrorMsg string `json:"error_message,omitempty"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
}
TestCaseResult 测试用例结果
type TestResult ¶ added in v0.2.1
type TestResult struct {
TotalTests int `json:"total_tests"`
PassedTests int `json:"passed_tests"`
FailedTests int `json:"failed_tests"`
Duration time.Duration `json:"duration"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
FailedCases []string `json:"failed_cases,omitempty"`
}
TestResult 测试结果