resource

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSchemaFileFromStruct

func CreateSchemaFileFromStruct(path string, _b []byte) bool

func DeepCopy

func DeepCopy(value interface{}) interface{}

func GetExpectsFields

func GetExpectsFields(expects []map[string]interface{}) ([]string, []string)

func GetLocalRepositoryRoot

func GetLocalRepositoryRoot() string

Deprecated 请用GetRuntimeRepositoryRoot

func GetResourceLocalRoot

func GetResourceLocalRoot() string

func GetRuntimeRepositoryRoot

func GetRuntimeRepositoryRoot() string

func GetYmlFilePathInRuntime

func GetYmlFilePathInRuntime(skip int) (string, error)

GetYmlFilePathInRuntime skip is the number of stack frames to ascend

func InferDataSetDir

func InferDataSetDir(skip int) (string, error)

InferDataSetDir 返回 t 的用例数据文件绝对路径

func InferRepository

func InferRepository()

func LoadDefaultReq

func LoadDefaultReq(caseSelect string, request interface{}) (err error)

func LoadFile

func LoadFile(relPath string, target interface{}) error

func PreInferRepositoryRoot

func PreInferRepositoryRoot()

func ReplaceFields

func ReplaceFields(s string, fieldsMap map[string]interface{})

func SetResourceLocalRoot

func SetResourceLocalRoot(v string)

func TranslateCompilePath2RuntimePath

func TranslateCompilePath2RuntimePath(compilePath string) string

func UnmarshalExpect

func UnmarshalExpect(expect map[string]interface{}) *assert.Expect

Types

type Action

type Action struct {
	Name    string          `json:"name"`
	Params  interface{}     `json:"params"`
	Expects []assert.Expect `json:"expects"`
}

type CaseData

type CaseData struct {
	// Properties include the basic properties of single case
	Properties CaseProperties `json:"properties"`
	// The Specific Input of case
	Input map[string]interface{} `json:"input" yaml:"input"`

	Actions map[string]interface{} `json:"actions"`

	// The expects of test method result
	Expects []assert.Expect `json:"expects" yaml:"expects"`

	SchemaFile string `json:"schema_file"`
}

func (*CaseData) CaseActionMarshal

func (cd *CaseData) CaseActionMarshal(target interface{}) error

func (*CaseData) InputJson

func (cd *CaseData) InputJson() *simplejson.Json

func (*CaseData) InputMarshal

func (cd *CaseData) InputMarshal(target interface{}) error

type CaseDataExpects

type CaseDataExpects struct {
	CaseName      string                     `json:"case_name"`
	ActionExpects map[string][]assert.Expect `json:"action_expects"`
	Expects       []assert.Expect            `json:"expects" yaml:"expects"`
}

type CaseDataHandleFunc

type CaseDataHandleFunc func(data *CaseData, args ...interface{})

type CaseDataLoadFunc

type CaseDataLoadFunc func(dataSet *CaseDataSet) *CaseDataSet

type CaseDataSet

type CaseDataSet struct {
	// GlobalOption takes effect when the option of single case is nil
	GlobalOption CaseOption `json:"global_option"`
	// CommonInput will be merged into the input of each single case
	CommonInput map[string]interface{} `json:"common_input"`

	CommonActions map[string]interface{} `json:"common_actions"`

	// Set is the actual case data definition
	Set []CaseData `json:"set"`
}

CaseDataSet is the basic definition of data set file

func LoadCaseDataSetFromFile

func LoadCaseDataSetFromFile(dir, common, tName string) *CaseDataSet

func (*CaseDataSet) FillDataFields

func (dataSet *CaseDataSet) FillDataFields(fieldsMap map[string][]map[string]interface{})

type CaseOption

type CaseOption struct {
	Parallel   *bool
	Skip       *bool
	PathPreFix string
}

func (*CaseOption) IsParallel

func (opt *CaseOption) IsParallel() bool

func (*CaseOption) IsSkip

func (opt *CaseOption) IsSkip() bool

func (*CaseOption) Merge

func (opt *CaseOption) Merge(targetOpt CaseOption)

type CaseProperties

type CaseProperties struct {
	Name           string                 `json:"name"`
	Desc           string                 `json:"desc"`
	Level          string                 `json:"level"`
	Option         CaseOption             `json:"option"`
	Extra          map[string]interface{} `json:"extra"`
	DataPathPreFix string                 `json:"data_path_pre_fix"`
}

func (*CaseProperties) ConvertMap

func (p *CaseProperties) ConvertMap() map[string]interface{}

func (*CaseProperties) ExtraProperties

func (p *CaseProperties) ExtraProperties() *simplejson.Json

func (*CaseProperties) Merge

func (p *CaseProperties) Merge(target map[string]interface{})

func (*CaseProperties) Unmarshal

func (p *CaseProperties) Unmarshal(m map[string]interface{})

type FillExpectRequest

type FillExpectRequest struct {
	DBName      string                 `json:"db_name"`
	DBTableName string                 `json:"db_table_name"`
	DBArgs      map[string]interface{} `json:"db_args"`
	DBResult    interface{}            `json:"db_result"`
	RedisPsm    string                 `json:"redis_psm"`
}

type TRes

type TRes struct {
	Name  string `json:"name"`
	Input string `json:"input"`
}

type TTestCaseInfo

type TTestCaseInfo struct {
	Id         int64     `gorm:"column:id;primary_key" json:"id"`
	Name       string    `gorm:"column:name;unique" json:"name"`
	Desc       string    `gorm:"column:case_desc"json:"case_desc"`
	Level      string    `gorm:"column:level" json:"level"`
	Skip       bool      `gorm:"column:skip" json:"skip"`
	Parallel   bool      `gorm:"column:parallel" json:"parallel"`
	TestFunc   string    `gorm:"column:func_name" json:"func_name"`
	Input      string    `gorm:"column:input" json:"input"`
	Expects    string    `gorm:"column:expects" json:"expects"`
	UpdateBy   string    `gorm:"column:update_by" json:"update_by"`
	CreateTime time.Time `gorm:"column:create_time" json:"create_time"`
	UpdateTime time.Time `gorm:"column:update_time" json:"update_time"`
}

func (TTestCaseInfo) TableName

func (TTestCaseInfo) TableName() string

Jump to

Keyboard shortcuts

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