command

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorIDduplicate        = errors.New("testcase's ID duplicate")
	ErrorDependencyNotExist = errors.New("dependency does not exist")
	ErrorIDRestrict         = errors.New("the ID of the dependent testcase must be smaller than the ID of the current testcase")
)

Functions

func AllCheck added in v0.0.3

func AllCheck() error

func CheckTestCaseGrpc added in v0.0.6

func CheckTestCaseGrpc() error

func CheckTestCaseHttp added in v0.0.6

func CheckTestCaseHttp() error

func ExtractXpath added in v0.0.2

func ExtractXpath(ctx context.Context, cmd *cli.Command) error

func GenReportFileGrpc added in v0.0.6

func GenReportFileGrpc(testCasefilePath string, tcResultList []GrpcTestCaseResult, info *ResultInfo)

func GenReportFileHttp added in v0.0.6

func GenReportFileHttp(testCasefilePath string, tcResultList []HttpTestCaseResult, info *ResultInfo)

func HandleSingleFileGrpc added in v0.0.6

func HandleSingleFileGrpc(workerNum int, filePath string) (*ResultInfo, []GrpcTestCaseResult)

func HandleSingleFileHttp added in v0.0.6

func HandleSingleFileHttp(workerNum int, filePath string) (*ResultInfo, []HttpTestCaseResult)

func RenderTpl added in v0.1.5

func RenderTpl(fs embed.FS, key string, obj map[string]any, targetPath string) error

func RunTestCases

func RunTestCases(ctx context.Context, cmd *cli.Command) error

func ValidateBodyFields added in v0.2.1

func ValidateBodyFields(testCaseId uint64, body, luaBody string) error

ValidateBodyFields 验证body和luaBody字段

func ValidateConfig

func ValidateConfig(ctx context.Context, cmd *cli.Command) error

func ValidateDependencies added in v0.2.1

func ValidateDependencies[T interface {
	GetID() uint64
	GetDependOnIDs() []uint64
}](filePath string, testcases []T) error

ValidateDependencies 验证依赖关系

func ValidateTestCaseIDs added in v0.2.1

func ValidateTestCaseIDs[T model.IdItem](filePath string, testcases []T) error

ValidateTestCaseIDs 验证测试用例ID是否重复

func ValidateXPath added in v0.2.1

func ValidateXPath(testCaseId uint64, xpathStr string) error

ValidateXPath 验证XPath语法

Types

type CaseShow added in v0.1.5

type CaseShow struct {
	ID          uint64
	Description string
	State       string
	Reason      string
	Link        string
}

type EventHandler added in v0.0.6

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

func NewEventHandler added in v0.0.6

func NewEventHandler(formatter grpcurl.Formatter) *EventHandler

func (*EventHandler) OnReceiveHeaders added in v0.0.6

func (m *EventHandler) OnReceiveHeaders(md metadata.MD)

func (*EventHandler) OnReceiveResponse added in v0.0.6

func (m *EventHandler) OnReceiveResponse(msg proto.Message)

func (*EventHandler) OnReceiveTrailers added in v0.0.6

func (m *EventHandler) OnReceiveTrailers(status *status.Status, md metadata.MD)

func (*EventHandler) OnResolveMethod added in v0.0.6

func (m *EventHandler) OnResolveMethod(descriptor *desc.MethodDescriptor)

func (*EventHandler) OnSendHeaders added in v0.0.6

func (m *EventHandler) OnSendHeaders(md metadata.MD)

type GrpcTestCallable added in v0.0.6

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

func (*GrpcTestCallable) Call added in v0.0.6

type GrpcTestCaseResult added in v0.0.6

type GrpcTestCaseResult struct {
	State  model.State
	ID     uint64
	Desc   string
	Reason model.Reason
	// actual request
	Request   config.RequestGrpc
	TestCase  *config.TestCaseGrpc
	KeyValues map[string]any
	Error     error
	Response  *model.GrpcResp
}

func (*GrpcTestCaseResult) ReqDetail added in v0.1.6

func (t *GrpcTestCaseResult) ReqDetail() string

func (*GrpcTestCaseResult) RespDetail added in v0.1.6

func (t *GrpcTestCaseResult) RespDetail() string

type HttpTestCallable

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

func (*HttpTestCallable) Call

type HttpTestCaseResult

type HttpTestCaseResult struct {
	State  model.State
	ID     uint64
	Desc   string
	Reason model.Reason
	// actual request
	Request   config.RequestHttp
	TestCase  *config.TestCaseHttp
	KeyValues map[string]any
	Error     error
	Response  *resty.Response
}

func (*HttpTestCaseResult) ReqDetail added in v0.1.5

func (t *HttpTestCaseResult) ReqDetail() string

func (*HttpTestCaseResult) RespDetail added in v0.1.5

func (t *HttpTestCaseResult) RespDetail() string

type ResultInfo

type ResultInfo struct {
	Total        int
	SuccessCount int
	FailedCount  int
}

type UnifiedTestResults added in v0.2.1

type UnifiedTestResults struct {
	TotalTests  int
	PassedTests int
	FailedTests int
	FailedCases []string
}

UnifiedTestResults 统一的测试结果

func CombineResults added in v0.2.1

func CombineResults(httpResults, grpcResults *UnifiedTestResults) *UnifiedTestResults

CombineResults 合并HTTP和gRPC测试结果

func GrpcAutomateTest added in v0.0.6

func GrpcAutomateTest(grpcTestCases map[string][]*config.TestCaseGrpc) *UnifiedTestResults

func HttpAutomateTest

func HttpAutomateTest(httpTestCases map[string][]*config.TestCaseHttp) *UnifiedTestResults

Jump to

Keyboard shortcuts

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