models

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GrpcProtoSourceTypeReflection = "reflection"
	GrpcProtoSourceTypeProtoset   = "protoset"
)

Variables

This section is empty.

Functions

func NewBodyError

func NewBodyError(msg string, args ...interface{}) error

func NewBodyErrorWithCause

func NewBodyErrorWithCause(err error, msg string, args ...interface{}) error

func NewDatabaseError

func NewDatabaseError(msg string, args ...interface{}) error

func NewDatabaseErrorWithCause

func NewDatabaseErrorWithCause(err error, msg string, args ...interface{}) error

func NewDatabaseErrorWithIdentifier

func NewDatabaseErrorWithIdentifier(queryIndex int, msg string, args ...interface{}) error

func NewHeaderError

func NewHeaderError(msg string, args ...interface{}) error

func NewMockError

func NewMockError(msg string, args ...interface{}) error

func NewMockErrorWithService

func NewMockErrorWithService(serviceName, msg string, args ...interface{}) error

func NewStatusCodeError

func NewStatusCodeError(expected, actual int) error

Types

type AllureLabel

type AllureLabel struct {
	Name  string `json:"name" yaml:"name"`
	Value string `json:"value" yaml:"value"`
}
type AllureLink struct {
	Name string `json:"name" yaml:"name"`
	URL  string `json:"url" yaml:"url"`
	Type string `json:"type" yaml:"type"`
}

type AllureMetadata

type AllureMetadata struct {
	Links      []AllureLink      `json:"links" yaml:"links"`
	Labels     []AllureLabel     `json:"labels" yaml:"labels"`
	Parameters []AllureParameter `json:"parameters" yaml:"parameters"`
}

AllureMetadata contains metadata for Allure 2 reports and TMS integration

type AllureParameter

type AllureParameter struct {
	Name  string `json:"name" yaml:"name"`
	Value string `json:"value" yaml:"value"`
}

type CheckError

type CheckError struct {
	Category   ErrorCategory
	Identifier string
	Message    string
	Err        error
}

CheckError represents a typed error from a specific check

func (*CheckError) Error

func (e *CheckError) Error() string

func (*CheckError) GetCategory

func (e *CheckError) GetCategory() ErrorCategory

func (*CheckError) GetIdentifier

func (e *CheckError) GetIdentifier() string

func (*CheckError) Unwrap

func (e *CheckError) Unwrap() error

type DatabaseCheck

type DatabaseCheck interface {
	DbNameString() string
	DbQueryString() string
	DbResponseJson() []string

	SetDbQueryString(string)
	SetDbResponseJson([]string)
}

type DatabaseResult

type DatabaseResult struct {
	Query    string
	Response []string
}

DatabaseResult holds the result of a single database query check.

type ErrorCategory

type ErrorCategory string

ErrorCategory defines the type of check that failed

const (
	ErrorCategoryStatusCode     ErrorCategory = "status_code"
	ErrorCategoryResponseBody   ErrorCategory = "body"
	ErrorCategoryResponseHeader ErrorCategory = "header"
	ErrorCategoryDatabase       ErrorCategory = "database"
	ErrorCategoryMock           ErrorCategory = "mock"
)

type Fixture

type Fixture struct {
	DbName string   `json:"dbName" yaml:"dbName"`
	Files  []string `json:"files" yaml:"files"`
}

type FixturesMultiDb

type FixturesMultiDb []Fixture

type Form

type Form struct {
	Files  map[string]string `json:"files" yaml:"files"`
	Fields map[string]string `json:"fields" yaml:"fields"`
}

type GrpcProtoSource

type GrpcProtoSource struct {
	// Type is the source type: "reflection" or "protoset".
	Type string `json:"type" yaml:"type"`
	// ProtosetFile is the path to the .protoset file (used when Type is "protoset").
	ProtosetFile string `json:"protoset_file" yaml:"protoset_file"`
}

GrpcProtoSource describes the proto-schema source for schema discovery.

type Result

type Result struct {
	Path                string // TODO: remove
	Query               string // TODO: remove
	RequestBody         string
	ResponseStatusCode  int
	ResponseStatus      string
	ResponseContentType string
	ResponseBody        string
	ResponseHeaders     map[string][]string
	GrpcStatusCode      int
	GrpcStatusMessage   string
	GrpcTrailers        map[string][]string
	Errors              []error
	Test                TestInterface
	DatabaseResult      []DatabaseResult
}

Result of test execution

func (*Result) AllureStatus

func (r *Result) AllureStatus() (string, error)

func (*Result) Passed

func (r *Result) Passed() bool

Passed returns true if test passed (false otherwise)

type Summary

type Summary struct {
	Success bool
	Failed  int
	Skipped int
	Broken  int
	Total   int
}

type TestInterface

type TestInterface interface {
	ToQuery() string
	GetRequest() string
	ToJSON() ([]byte, error)
	GetMethod() string
	Path() string
	GetResponses() map[int]string
	GetResponse(code int) (string, bool)
	GetResponseHeaders(code int) (map[string]string, bool)
	GetName() string
	GetDescription() string
	GetStatus() string
	SetStatus(string)
	Fixtures() []string
	FixturesMultiDb() FixturesMultiDb
	ServiceMocks() map[string]interface{}
	GrpcServiceMocks() map[string]interface{}
	Pause() int
	BeforeScriptPath() string
	BeforeScriptTimeout() int
	AfterRequestScriptPath() string
	AfterRequestScriptTimeout() int
	Cookies() map[string]string
	Headers() map[string]string
	ContentType() string
	GetForm() *Form
	DbNameString() string
	DbQueryString() string
	DbResponseJson() []string
	GetVariables() map[string]string
	GetCombinedVariables() map[string]string
	GetVariablesToSet() map[int]map[string]string
	GetDatabaseChecks() []DatabaseCheck
	SetDatabaseChecks([]DatabaseCheck)

	GetFileName() string

	// setters
	SetQuery(string)
	SetMethod(string)
	SetPath(string)
	SetRequest(string)
	SetForm(form *Form)
	SetResponses(map[int]string)
	SetHeaders(map[string]string)
	SetDbQueryString(string)
	SetDbResponseJson([]string)

	// comparison properties
	NeedsCheckingValues() bool
	IgnoreArraysOrdering() bool
	DisallowExtraFields() bool
	IgnoreDbOrdering() bool

	// Clone returns copy of current object
	Clone() TestInterface

	// gRPC transport methods
	GetTransport() string
	GetProtoSource() *GrpcProtoSource

	// Allure metadata for TMS integration
	GetAllureMetadata() *AllureMetadata
}

Common Test interface

Jump to

Keyboard shortcuts

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