Documentation
¶
Index ¶
- Variables
- func GetLogger() zerolog.Logger
- func NewRunner(t *testing.T) *runner
- func Run(testcases ...ITestCase) error
- func SetLogLevel(level string)
- func SetLogPretty()
- type Boomer
- type IStep
- type ITestCase
- type Request
- type TCase
- type TConfig
- func (c *TConfig) ExportVars(vars ...string) *TConfig
- func (c *TConfig) SetBaseURL(baseURL string) *TConfig
- func (c *TConfig) SetVerifySSL(verify bool) *TConfig
- func (c *TConfig) SetWeight(weight int) *TConfig
- func (c *TConfig) WithParameters(parameters map[string]interface{}) *TConfig
- func (c *TConfig) WithVariables(variables map[string]interface{}) *TConfig
- type TStep
- func (s *TStep) CallRefCase(tc *TestCase) *testcaseWithOptionalArgs
- func (s *TStep) DELETE(url string) *requestWithOptionalArgs
- func (s *TStep) GET(url string) *requestWithOptionalArgs
- func (s *TStep) HEAD(url string) *requestWithOptionalArgs
- func (s *TStep) OPTIONS(url string) *requestWithOptionalArgs
- func (s *TStep) PATCH(url string) *requestWithOptionalArgs
- func (s *TStep) POST(url string) *requestWithOptionalArgs
- func (s *TStep) PUT(url string) *requestWithOptionalArgs
- func (s *TStep) SetupHook(hook string) *TStep
- func (s *TStep) WithVariables(variables map[string]interface{}) *TStep
- type TestCase
- type TestCasePath
- type Validator
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupportedFileExt = fmt.Errorf("unsupported testcase file extension")
Functions ¶
func SetLogLevel ¶
func SetLogLevel(level string)
func SetLogPretty ¶
func SetLogPretty()
Types ¶
type Boomer ¶
func NewStandaloneBoomer ¶
type IStep ¶
type IStep interface {
// contains filtered or unexported methods
}
IStep represents interface for all types for teststeps
type Request ¶ added in v0.2.2
type Request struct {
Method string `json:"method" yaml:"method"` // required
URL string `json:"url" yaml:"url"` // required
Params map[string]interface{} `json:"params,omitempty" yaml:"params,omitempty"`
Headers map[string]string `json:"headers,omitempty" yaml:"headers,omitempty"`
Cookies map[string]string `json:"cookies,omitempty" yaml:"cookies,omitempty"`
Body interface{} `json:"body,omitempty" yaml:"body,omitempty"`
Timeout float32 `json:"timeout,omitempty" yaml:"timeout,omitempty"`
AllowRedirects bool `json:"allow_redirects,omitempty" yaml:"allow_redirects,omitempty"`
Verify bool `json:"verify,omitempty" yaml:"verify,omitempty"`
}
Request represents HTTP request data structure. This is used for teststep.
type TCase ¶
type TCase struct {
Config *TConfig `json:"config" yaml:"config"`
TestSteps []*TStep `json:"teststeps" yaml:"teststeps"`
}
TCase represents testcase data structure. Each testcase includes one public config and several sequential teststeps.
func (*TCase) ToTestCase ¶
type TConfig ¶
type TConfig struct {
Name string `json:"name" yaml:"name"` // required
Verify bool `json:"verify,omitempty" yaml:"verify,omitempty"`
BaseURL string `json:"base_url,omitempty" yaml:"base_url,omitempty"`
Variables map[string]interface{} `json:"variables,omitempty" yaml:"variables,omitempty"`
Parameters map[string]interface{} `json:"parameters,omitempty" yaml:"parameters,omitempty"`
Export []string `json:"export,omitempty" yaml:"export,omitempty"`
Weight int `json:"weight,omitempty" yaml:"weight,omitempty"`
}
TConfig represents config data structure for testcase. Each testcase should contain one config part.
func NewConfig ¶ added in v0.2.2
NewConfig returns a new constructed testcase config with specified testcase name.
func (*TConfig) ExportVars ¶ added in v0.2.2
ExportVars specifies variable names to export for current testcase.
func (*TConfig) SetBaseURL ¶ added in v0.2.2
SetBaseURL sets base URL for current testcase.
func (*TConfig) SetVerifySSL ¶ added in v0.2.2
SetVerifySSL sets whether to verify SSL for current testcase.
func (*TConfig) SetWeight ¶ added in v0.2.2
SetWeight sets weight for current testcase, which is used in load testing.
func (*TConfig) WithParameters ¶ added in v0.2.2
WithParameters sets parameters for current testcase.
func (*TConfig) WithVariables ¶ added in v0.2.2
WithVariables sets variables for current testcase.
type TStep ¶
type TStep struct {
Name string `json:"name" yaml:"name"` // required
Request *Request `json:"request,omitempty" yaml:"request,omitempty"`
TestCase *TestCase `json:"testcase,omitempty" yaml:"testcase,omitempty"`
Variables map[string]interface{} `json:"variables,omitempty" yaml:"variables,omitempty"`
SetupHooks []string `json:"setup_hooks,omitempty" yaml:"setup_hooks,omitempty"`
TeardownHooks []string `json:"teardown_hooks,omitempty" yaml:"teardown_hooks,omitempty"`
Extract map[string]string `json:"extract,omitempty" yaml:"extract,omitempty"`
Validators []Validator `json:"validate,omitempty" yaml:"validate,omitempty"`
Export []string `json:"export,omitempty" yaml:"export,omitempty"`
}
TStep represents teststep data structure. Each step maybe two different type: make one HTTP request or reference another testcase.
func (*TStep) CallRefCase ¶ added in v0.2.2
CallRefCase calls a referenced testcase.
func (*TStep) WithVariables ¶ added in v0.2.2
WithVariables sets variables for current teststep.
type TestCase ¶
TestCase is a container for one testcase. used for testcase runner
func (*TestCase) ToTestCase ¶
type TestCasePath ¶
type TestCasePath struct {
Path string
}
func (*TestCasePath) ToTCase ¶
func (path *TestCasePath) ToTCase() (*TCase, error)
func (*TestCasePath) ToTestCase ¶
func (path *TestCasePath) ToTestCase() (*TestCase, error)
type Validator ¶ added in v0.2.2
type Validator struct {
Check string `json:"check" yaml:"check"` // get value with jmespath
Assert string `json:"assert" yaml:"assert"`
Expect interface{} `json:"expect" yaml:"expect"`
Message string `json:"msg,omitempty" yaml:"msg,omitempty"` // optional
}
Validator represents validator for one HTTP response.

