Documentation
¶
Overview ¶
Package testing provide the test case functions
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmptyThenDefault ¶ added in v0.0.12
EmptyThenDefault return the default value if the val is empty
func ZeroThenDefault ¶ added in v0.0.12
ZeroThenDefault return the default value if the val is zero
Types ¶
type Job ¶ added in v0.0.12
type Job struct {
Items []string `yaml:"items"`
}
Job contains a list of jobs
type Loader ¶ added in v0.0.12
type Loader interface { HasMore() bool Load() ([]byte, error) Put(string) (err error) GetContext() string GetCount() int }
Loader is an interface for test cases loader
func NewFileLoader ¶ added in v0.0.12
func NewFileLoader() Loader
NewFileLoader creates the instance of file loader
type Request ¶
type Request struct { API string `yaml:"api" json:"api"` Method string `yaml:"method,omitempty" json:"method,omitempty" jsonschema:"enum=GET,enum=POST,enum=PUT,enum=DELETE"` Query map[string]string `yaml:"query,omitempty" json:"query,omitempty"` Header map[string]string `yaml:"header,omitempty" json:"header,omitempty"` Form map[string]string `yaml:"form,omitempty" json:"form,omitempty"` Body string `yaml:"body,omitempty" json:"body,omitempty"` BodyFromFile string `yaml:"bodyFromFile,omitempty" json:"bodyFromFile,omitempty"` }
Request represents a HTTP request
type Response ¶
type Response struct { StatusCode int `yaml:"statusCode,omitempty" json:"statusCode,omitempty"` Body string `yaml:"body,omitempty" json:"body,omitempty"` Header map[string]string `yaml:"header,omitempty" json:"header,omitempty"` BodyFieldsExpect map[string]interface{} `yaml:"bodyFieldsExpect,omitempty" json:"bodyFieldsExpect,omitempty"` Verify []string `yaml:"verify,omitempty" json:"verify,omitempty"` Schema string `yaml:"schema,omitempty" json:"schema,omitempty"` }
Response is the expected response
type TestCase ¶
type TestCase struct { Name string `yaml:"name,omitempty" json:"name"` Group string `yaml:"group,omitempty" json:"group"` Before Job `yaml:"before,omitempty" json:"before"` After Job `yaml:"after,omitempty" json:"after"` Request Request `yaml:"request" json:"request"` Expect Response `yaml:"expect,omitempty" json:"expect"` }
TestCase represents a test case
func ParseTestCaseFromData ¶ added in v0.0.5
ParseTestCaseFromData parses the data to a test case
type TestSuite ¶ added in v0.0.2
type TestSuite struct { Name string `yaml:"name,omitempty" json:"name"` API string `yaml:"api,omitempty" json:"api,omitempty"` Items []TestCase `yaml:"items" json:"items"` }
TestSuite represents a set of test cases
func ParseFromData ¶ added in v0.0.5
ParseFromData parses data and returns the test suite
Click to show internal directories.
Click to hide internal directories.