Documentation ¶
Overview ¶
Package context provides the test context of scenarigo.
Index ¶
- func RunWithRetry(c *Context, name string, f func(*Context), policy reporter.RetryPolicy) bool
- type Context
- func (c *Context) EnabledColor() bool
- func (c *Context) ExecuteTemplate(i interface{}) (interface{}, error)
- func (c *Context) ExtractByKey(key string) (interface{}, bool)
- func (c *Context) Node() ast.Node
- func (c *Context) PluginDir() string
- func (c *Context) Plugins() Plugins
- func (c *Context) Reporter() reporter.Reporter
- func (c *Context) Request() interface{}
- func (c *Context) RequestContext() context.Context
- func (c *Context) Response() interface{}
- func (c *Context) Run(name string, f func(*Context)) bool
- func (c *Context) ScenarioFilepath() string
- func (c *Context) Steps() *Steps
- func (c *Context) Vars() Vars
- func (c *Context) WithEnabledColor(enabledColor bool) *Context
- func (c *Context) WithNode(node ast.Node) *Context
- func (c *Context) WithPluginDir(path string) *Context
- func (c *Context) WithPlugins(ps map[string]interface{}) *Context
- func (c *Context) WithReporter(r reporter.Reporter) *Context
- func (c *Context) WithRequest(req interface{}) *Context
- func (c *Context) WithRequestContext(reqCtx context.Context) *Context
- func (c *Context) WithResponse(resp interface{}) *Context
- func (c *Context) WithScenarioFilepath(path string) *Context
- func (c *Context) WithSteps(steps *Steps) *Context
- func (c *Context) WithVars(v interface{}) *Context
- type Plugins
- type Step
- type Steps
- type Vars
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunWithRetry ¶ added in v0.14.0
RunWithRetry runs f as a subtest of c called name with retry.
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context represents a scenarigo context.
func (*Context) EnabledColor ¶ added in v0.3.0
EnabledColor returns whether color output is enabled.
func (*Context) ExecuteTemplate ¶
ExecuteTemplate executes template strings in context.
func (*Context) ExtractByKey ¶
ExtractByKey implements query.KeyExtractor interface.
func (*Context) RequestContext ¶
RequestContext returns the context.Context for request.
func (*Context) ScenarioFilepath ¶ added in v0.6.0
ScenarioFilepath returns the filepath of the scenario executing in this context.
func (*Context) WithEnabledColor ¶ added in v0.3.0
WithEnabledColor returns a copy of c with enabledColor flag.
func (*Context) WithPluginDir ¶
WithPluginDir returns a copy of c with plugin root directory.
func (*Context) WithPlugins ¶
WithPlugins returns a copy of c with ps.
func (*Context) WithReporter ¶
WithReporter returns a copy of c with new test reporter.
func (*Context) WithRequest ¶
WithRequest returns a copy of c with request.
func (*Context) WithRequestContext ¶
WithRequestContext returns the context.Context for request.
func (*Context) WithResponse ¶
WithResponse returns a copy of c with response.
func (*Context) WithScenarioFilepath ¶ added in v0.6.0
WithScenarioFilepath returns a copy of c with the scenario filepath.
type Plugins ¶
type Plugins []map[string]interface{}
Plugins represents plugins.
func (Plugins) ExtractByKey ¶
ExtractByKey implements query.KeyExtractor interface.
type Step ¶ added in v0.16.0
type Step struct { Result string `yaml:"result,omitempty"` Steps *Steps `yaml:"steps,omitempty"` // child steps }
Step represents a result of step.
type Steps ¶ added in v0.16.0
type Steps struct {
// contains filtered or unexported fields
}
Steps represents results of steps.
func (*Steps) ExtractByKey ¶ added in v0.16.0
ExtractByKey implements query.KeyExtractor interface.