mbcase

package
v0.0.0-...-e9f0680 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assert

type Assert struct {
	Response     Response       `json:"response" yaml:"response"`
	OtherAsserts []CommonAssert `json:"otherAsserts" yaml:"otherAsserts"`
}

func (*Assert) ResponseDataString

func (a *Assert) ResponseDataString() string

type CaseRequest

type CaseRequest struct {
	Header map[string]string `json:"header" yaml:"header"`
	Query  url.Values        `json:"query" yaml:"query"`
	Data   interface{}       `json:"data" yaml:"data"`
}

CaseRequest case request data.

func (*CaseRequest) BodyString

func (c *CaseRequest) BodyString() (string, error)

type CaseTask

type CaseTask struct {
	Name        string                       `json:"name" yaml:"name"`
	Description string                       `json:"description" yaml:"description"`
	SetUp       []*Command                   `json:"setup" yaml:"setup"`
	Mocks       []*interact.ImposterMockCase `json:"mocks" yaml:"mocks"`
	Request     *CaseRequest                 `json:"request" yaml:"request"`
	Assert      *Assert                      `json:"assert" yaml:"assert"`
	TearDown    []*Command                   `json:"teardown" yaml:"teardown"`
}

CaseTask case level

type Command

type Command struct {
	TypeName string   `json:"typeName" yaml:"typeName"` // mysql, redis..
	Commands []string `json:"commands" yaml:"commands"`
}

type CommonAssert

type CommonAssert struct {
	TypeName string      `json:"typeName" yaml:"typeName"` // mysql, redis..
	Actual   string      `json:"actual" yaml:"actual"`     // the actual return value of the target.
	Expected interface{} `json:"expected" yaml:"expected"` // the expected return valueresult.
}

func (*CommonAssert) ExpectedString

func (c *CommonAssert) ExpectedString() string

type ItfTask

type ItfTask struct {
	*TaskInfo
	SetUp    []*Command                   `json:"setup" yaml:"setUp"`
	Mocks    []*interact.ImposterMockCase `json:"mocks" yaml:"mocks"`
	TearDown []*Command                   `json:"teardown" yaml:"teardown"`
	Cases    []*CaseTask                  `json:"cases" yaml:"cases"`
}

ItfTask interface level.

type ItfTaskWithFileInfo

type ItfTaskWithFileInfo struct {
	Dirpath      string    `json:"dirpath" yaml:"dirpath"`
	Filename     string    `json:"filename" yaml:"filename"`
	ModifiedTime time.Time `json:"modifiedTime" yaml:"modifiedTime"`

	*ItfTask
}

Record some file information

type Protocol

type Protocol string

Protocol defines the protocol of request

const (
	ProtocolHTTP Protocol = "http"
	ProtocolGRPC Protocol = "grpc"
)

defines a set of known protocols

type Response

type Response struct {
	Header     map[string]string `json:"header" yaml:"header"`
	Data       interface{}       `json:"data" yaml:"data"`
	StatusCode int               `json:"statusCode" yaml:"statusCode"`
}

type TaskInfo

type TaskInfo struct {
	Protocol Protocol `json:"protocol" yaml:"protocol"`
	// ServiceName cannot repeat
	ServiceName string `json:"serviceName" yaml:"serviceName"`
	// if it's grpc interface, it is always POST
	ServiceMethod      string `json:"serviceMethod" yaml:"serviceMethod"` // POST GET PUT
	ServiceDescription string `json:"serviceDescription" yaml:"serviceDescription"`

	// test target
	// http: "/hello"
	// grpc: "/examples.greeter.proto.Greeter/Hello"
	ServicePath string `json:"servicePath" yaml:"servicePath"`

	// if grpc, need protofile path
	ServiceProtoFile string `json:"serviceProtoFile" yaml:"servicePath"`
}

Jump to

Keyboard shortcuts

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