Documentation ¶
Overview ¶
Package scene include test file(yaml) and how to parse yaml
Index ¶
- func Assert(check []*Check, params map[string][]byte) error
- func From(source *entity.HTTPResponse, from FromType) any
- func GetUuid(prefix string) string
- func Load(data []byte, scene *Scene) error
- func LoadJSONFile(file string, scene *Scene) error
- func LoadYamlFile(file string, scene *Scene) error
- func Render(origin string, variables map[string]any) (string, error)
- func ToBytes(str string) []byte
- func ToString(bs []byte) string
- type Assertion
- type Check
- type ExtractType
- type Extractor
- type FromType
- type JSONPathExtractor
- type Out
- type RegexExtractor
- type Scene
- type Step
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadJSONFile ¶
func LoadYamlFile ¶
Types ¶
type Check ¶
type Check struct { Name string `json:"name" yaml:"name"` AssertType Assertion `json:"assert_type" yaml:"assert_type"` Expected string `json:"expected" yaml:"expected"` Actually string `json:"actually" yaml:"actually"` ErrorMsg string `json:"error_msg" yaml:"error_msg"` Disabled bool `json:"disabled" yaml:"disabled"` }
Check assert for the step
type ExtractType ¶
type ExtractType string
const ( JSONPath ExtractType = "JSONPath" Regex ExtractType = "Regex" )
type Extractor ¶
type Extractor interface {
Extract(source *entity.HTTPResponse) ([]byte, error)
}
func NewExtractor ¶
func NewJSONPathExtractor ¶
type JSONPathExtractor ¶
type JSONPathExtractor struct {
// contains filtered or unexported fields
}
func (*JSONPathExtractor) Extract ¶
func (j *JSONPathExtractor) Extract(source *entity.HTTPResponse) (s []byte, err error)
type Out ¶
type Out struct { Name string `json:"name" yaml:"name"` // parameters from From FromType `json:"from" yaml:"from"` ExtractType ExtractType `json:"extractType" yaml:"extract_type"` Expression string `json:"expression" yaml:"expression"` Variable string `json:"variable" yaml:"variable"` }
Out extract parameters
type RegexExtractor ¶
type RegexExtractor struct {
// contains filtered or unexported fields
}
type Scene ¶
type Scene struct { Name string `json:"name" yaml:"name"` Steps []*Step `json:"steps" yaml:"steps"` }
Scene a testing scene
type Step ¶
type Step struct { Name string `yaml:"name" json:"name"` Url string `yaml:"url" json:"url"` Headers map[string]string `json:"headers" yaml:"headers"` Method string `yaml:"method" json:"method"` Body string `json:"body" yaml:"body"` StatusCheck bool `json:"status_check" yaml:"status_check"` Out []*Out `json:"out" yaml:"out"` Check []*Check `json:"check" yaml:"check"` Query map[string]string `json:"query" yaml:"query"` Timeout int `json:"timeout"` }
Step test step
Click to show internal directories.
Click to hide internal directories.