Documentation
¶
Index ¶
- Constants
- func ReadFromFile(path string) (v *viper.Viper, err error)
- func ReadLines(path string) (lines map[int]map[int]string, err error)
- type Assert
- type AssertCookie
- type AssertHTML
- type AssertJSON
- type AssertTOML
- type AssertXML
- type AssertYAML
- type BasicAuth
- type Case
- type CaseConfig
- type Hook
- type Order
- type Parse
- type Request
- type Retry
- type RunConfig
Constants ¶
View Source
const ConfigType = "yaml"
View Source
const TplBrace = "{{"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Assert ¶
type Assert struct { Status string `yaml:"status"` StatusIn []string `yaml:"status_in" mapstructure:"status_in"` StatusNotIn []string `yaml:"status_not_in" mapstructure:"status_not_in"` StatusCode int `yaml:"statusCode"` StatusCodeIn []int `yaml:"statusCode_in" mapstructure:"statusCode_in"` StatusCodeNotIn []int `yaml:"statusCode_not_in" mapstructure:"statusCode_not_in"` StatusCodeLt int `yaml:"statusCode_lt" mapstructure:"statusCode_lt"` StatusCodeLte int `yaml:"statusCode_lte" mapstructure:"statusCode_lte"` StatusCodeGt int `yaml:"statusCode_gt" mapstructure:"statusCode_gt"` StatusCodeGte int `yaml:"statusCode_gte" mapstructure:"statusCode_gte"` ContentLength int64 `yaml:"contentLength"` ContentLengthLt int64 `yaml:"contentLength_lt" mapstructure:"contentLength_lt"` ContentLengthLte int64 `yaml:"contentLength_lte" mapstructure:"contentLength_lte"` ContentLengthGt int64 `yaml:"contentLength_gt" mapstructure:"contentLength_gt"` ContentLengthGte int64 `yaml:"contentLength_gte" mapstructure:"contentLength_gte"` ContentType string `yaml:"contentType"` ContentTypeIn []string `yaml:"contentType_in" mapstructure:"contentType_in"` ContentTypeNotIn []string `yaml:"contentType_not_in" mapstructure:"contentType_not_in"` // latency LatencyLt int64 `yaml:"latency_lt" mapstructure:"latency_lt"` LatencyLte int64 `yaml:"latency_lte" mapstructure:"latency_lte"` LatencyGt int64 `yaml:"latency_gt" mapstructure:"latency_gt"` LatencyGte int64 `yaml:"latency_gte" mapstructure:"latency_gte"` Body string `yaml:"body"` BodyContains []string `yaml:"body_contains" mapstructure:"body_contains"` BodyNotContains []string `yaml:"body_not_contains" mapstructure:"body_not_contains"` BodyIContains []string `yaml:"body_icontains" mapstructure:"body_icontains"` BodyStartsWith string `yaml:"body_startswith" mapstructure:"body_startswith"` BodyEndsWith string `yaml:"body_endswith" mapstructure:"body_endswith"` BodyNotStartsWith string `yaml:"body_not_startswith" mapstructure:"body_not_startswith"` BodyNotEndsWith string `yaml:"body_not_endswith" mapstructure:"body_not_endswith"` BodyMatches string `yaml:"body_matches" mapstructure:"body_matches"` BodyNotMatches string `yaml:"body_not_matches" mapstructure:"body_not_matches"` Header map[string]interface{} `yaml:"header"` HeaderExists []string `yaml:"header_exists" mapstructure:"header_exists"` HeaderValueMatches map[string]string `yaml:"header_value_matches" mapstructure:"header_value_matches"` HeaderValueContains map[string]string `yaml:"header_value_contains" mapstructure:"header_value_contains"` JSON []AssertJSON `yaml:"json" mapstructure:"json"` XML []AssertXML `yaml:"xml" mapstructure:"xml"` HTML []AssertHTML `yaml:"html" mapstructure:"html"` YAML []AssertYAML `yaml:"yaml" mapstructure:"yaml"` TOML []AssertTOML `yaml:"toml" mapstructure:"toml"` Cookie []AssertCookie `yaml:"cookie" mapstructure:"cookie"` CookieExists []string `yaml:"cookie_exists" mapstructure:"cookie_exists"` // if request fail like dial fail/context deadline exceeded, will do assert error_contains only, // will pass if the error message contains the string ErrorContains []string `yaml:"error_contains" mapstructure:"error_contains"` HasRedirect bool `yaml:"has_redirect" mapstructure:"has_redirect"` RedirectCountLt int64 `yaml:"redirectCount_lt" mapstructure:"redirectCount_lt"` RedirectCountLte int64 `yaml:"redirectCount_lte" mapstructure:"redirectCount_lte"` RedirectCountGt int64 `yaml:"redirectCount_gt" mapstructure:"redirectCount_gt"` RedirectCountGte int64 `yaml:"redirectCount_gte" mapstructure:"redirectCount_gte"` Proto string `yaml:"proto"` // e.g. "HTTP/1.0" ProtoMajor int `yaml:"protoMajor"` // e.g. 1 ProtoMinor int `yaml:"protoMinor"` // e.g. 0 }
type AssertCookie ¶
type AssertCookie struct { // NOTE: https://go.dev/src/net/http/cookie_test.go // current only support check all equals(Name, Value, Domain, Path) Name string Value string Domain string Path string }
type AssertHTML ¶
type AssertHTML struct { Path string Value interface{} }
type AssertJSON ¶
type AssertJSON struct { Path string Value interface{} }
func (*AssertJSON) Render ¶
func (a *AssertJSON) Render(ctx map[string]interface{})
type AssertTOML ¶
type AssertTOML struct { Path string Value interface{} }
type AssertYAML ¶
type AssertYAML struct { Path string Value interface{} }
type Case ¶
type Case struct { Title string Description string Path string Index int Config CaseConfig `mapstructure:"config"` Env map[string]interface{} Request Request Assert Assert Hook Hook Parse []Parse // caseIndex => {lineNo: lineContent} FileLines map[int]map[int]string AllKeys []string }
func ReadCasesFromFile ¶
func (*Case) GuessAssertLineNumber ¶
GetAssertLineNumber will guess the assertion line number toml: status = "ok" json: "status": "ok" yaml: status: ok ini: status=ok
type CaseConfig ¶
type Hook ¶
type Hook struct { SaveCookie string `mapstructure:"save_cookie"` SaveResponse string `mapstructure:"save_response"` Exec string `mapstructure:"exec"` Sleep int `mapstructure:"sleep"` }
TODO: use reflect instead hard code
type Request ¶
Click to show internal directories.
Click to hide internal directories.