Documentation ¶
Index ¶
- func CopyContext(dest, src *Context)
- func ReconstructContext(ctx *Context) error
- func RenderCleaners(ctx *Context, ccs []types.CleanerConfig) error
- func RenderExports(ctx *Context, exports []types.Var) error
- func RenderPresetters(ctx *Context, pcs []types.PresetConfig) error
- type Cleaner
- type Context
- type Definition
- type DefinitionType
- type Presetter
- type Request
- type Response
- type RoundTrip
- type RoundTripTemplate
- type Var
- type When
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyContext ¶
func CopyContext(dest, src *Context)
CopyContext copy content of context from src context
func ReconstructContext ¶
ReconstructContext will reconstruct context from parent and previous variable patch
func RenderCleaners ¶
func RenderCleaners(ctx *Context, ccs []types.CleanerConfig) error
RenderCleaners render cleaner config with current context and save into context
func RenderExports ¶
RenderExports render export variables
func RenderPresetters ¶
func RenderPresetters(ctx *Context, pcs []types.PresetConfig) error
RenderPresetters render preset config with current context and save into context
Types ¶
type Cleaner ¶
type Cleaner struct { // Name defines name of cleaner Name string // ForEach defines whether cleaner is called for each case ForEach bool // Args defines cleaner args Args map[string]string }
Cleaner defines cleaner args
type Context ¶
type Context struct { // Summary defines context summary Summary string // Parent defines parent context Parent *Context // Variables defines variables the context has Variables jsonutil.VariableMap // Exports defines variables exported by this context only Exports jsonutil.VariableMap // Presetters defines the presetters of context Presetters []Presetter // Cleaners defines the cleaners of context Cleaners []Cleaner // RoundTripTemplate defines template of roundtrip RoundTripTemplate *RoundTripTemplate }
Context defines context of test cases
type Definition ¶
type Definition struct { // Var defines Definition variable Var // Type defines variable from // enum ["body", "status", "header"] // default is body Type DefinitionType }
Definition defines variable definitions
type DefinitionType ¶
type DefinitionType string
DefinitionType defines where definition is from
const ( // BodyType means definition from body BodyType DefinitionType = "body" // HeaderType means definition from header HeaderType DefinitionType = "header" // StatusType means definition from status StatusType DefinitionType = "status" )
type Presetter ¶
type Presetter struct { // Name defines presetter name Name string // Args defines args of presetter Args map[string]string }
Presetter defines presetter args
type Request ¶
type Request struct { // Scheme defines scheme of http request // e.g. http or https Scheme string // Host defines host of http request Host string // Method defines http method, e.g. GET Method string // Path defines http request path Path string // PathTemplate defines template of path // call fmt.Sprintf(PathTemplate, path) to generate real API path PathTemplate string // Headers defines http request header Headers map[string]string // Body defines http request body Body []byte }
Request defines http request
type Response ¶
type Response struct { // StatusCode checks response code StatusCode int // Headers defines http request header Headers map[string]string // Body defines http request body Body []byte // Async defines whether the task is a async task Async bool // Timeout defines deadline of checking Timeout time.Duration // Interval defines interval of polling and checking Interval time.Duration }
Response defines http response
type RoundTrip ¶
type RoundTrip struct { // RoundTripTemplate defines round trip template RoundTripTemplate // When defines round trip condition When *When // Definitions defines variables from response Definitions []Definition }
RoundTrip defines a http round trip
type RoundTripTemplate ¶
type RoundTripTemplate struct { // Client defines http client used by this roundtrip Client string // Request defines http request Request Request // Response defines http response validator Response Response }
RoundTripTemplate defines template of round trip
func CopyRoundTripTemplate ¶
func CopyRoundTripTemplate(rt *RoundTripTemplate) *RoundTripTemplate
CopyRoundTripTemplate will return a copy of round trip
type Var ¶
type Var struct { // Name defines variable name Name string // Selector defines variable selector Selector []string }
Var defines variable