Documentation ¶
Index ¶
- type ContextGetter
- type InlineExecutor
- type Meta
- type Module
- type ParamQuoter
- type Scenario
- func (s *Scenario) AddVariables(params map[string]interface{}) error
- func (s *Scenario) CopyVariable(name string, source *Scenario) error
- func (s *Scenario) CopyVariables(source *Scenario) error
- func (s *Scenario) DeleteContext(name string)
- func (s *Scenario) DeleteContextAs(params map[string]interface{}, defprefix string, name string)
- func (s *Scenario) DeleteContextRegex(regex string)
- func (s *Scenario) DoCleanup()
- func (s *Scenario) Exec(val string, params map[string]interface{}) error
- func (s *Scenario) Expand(params interface{}) (interface{}, error)
- func (s *Scenario) ExpandList(params []interface{}) ([]interface{}, error)
- func (s *Scenario) ExpandMap(params map[string]interface{}) (map[string]interface{}, error)
- func (s *Scenario) ExpandString(param string) (string, error)
- func (s *Scenario) ExtractFunctions(steps []interface{}) error
- func (s *Scenario) GetBool(params map[string]interface{}, key string, def interface{}) (bool, error)
- func (s *Scenario) GetContext(name string) (string, bool)
- func (s *Scenario) GetList(params map[string]interface{}, key string, def interface{}) ([]interface{}, error)
- func (s *Scenario) GetMap(params map[string]interface{}, key string, def interface{}) (map[string]interface{}, error)
- func (s *Scenario) GetModule() string
- func (s *Scenario) GetNumber(params map[string]interface{}, key string, def interface{}) (int, error)
- func (s *Scenario) GetSteps(params map[string]interface{}, key string, def []map[string]interface{}) ([]map[string]interface{}, error)
- func (s *Scenario) GetStore(name string) interface{}
- func (s *Scenario) GetString(params map[string]interface{}, key string, def interface{}) (string, error)
- func (s *Scenario) Meta(val string) Meta
- func (s *Scenario) PutCleanup(k string, f func(*Scenario) error)
- func (s *Scenario) PutContext(name string, value interface{}) error
- func (s *Scenario) PutContextAs(params map[string]interface{}, defprefix string, name string, ...) error
- func (s *Scenario) PutContextCallerFunctio(name string, value interface{}) error
- func (s *Scenario) PutStore(name string, value interface{})
- func (s *Scenario) RemoveStore(name string)
- func (s *Scenario) Run(scen string) error
- func (s *Scenario) RunFromRoot(scen string) error
- func (s *Scenario) RunFunction(scen string, fun string) error
- func (s *Scenario) RunSteps(steps []interface{}) error
- type Step
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContextGetter ¶
type ContextGetter struct {
// contains filtered or unexported fields
}
func NewContextGetter ¶
func NewContextGetter(s *Scenario) *ContextGetter
type InlineExecutor ¶
type InlineExecutor struct {
// contains filtered or unexported fields
}
func NewInlineExecutor ¶
func NewInlineExecutor(s *Scenario) *InlineExecutor
type ParamQuoter ¶
type ParamQuoter struct {
Scen *Scenario
}
type Scenario ¶
type Scenario struct { Steps []interface{} M Module // Contains the variables Context []map[string]string // Contains the storage for the modules Store map[string]interface{} // Cleanup functions, set by modules Cleanup map[string]func(*Scenario) error // Functions Functions map[string][]interface{} Quoter ParamQuoter SubstQuoter *text.StringSubstitutor Executor *InlineExecutor SubstExecutor *text.StringSubstitutor Subst *text.StringSubstitutor // Caller, when the scenario is called from another one Caller *Scenario // Root, from where looking from modules Root string // Channel for errors // If an error is posted on the channel, the scenario stops ErrorChan chan (error) // Indicates if we are in a local function // It impacts the return steps InFunction bool Skip bool // contains filtered or unexported fields }
func NewScenario ¶
func NewScenario() *Scenario
func (*Scenario) AddVariables ¶
func (*Scenario) CopyVariable ¶
func (*Scenario) CopyVariables ¶
Add all the variables from params, excluding builtin variables
func (*Scenario) DeleteContext ¶
Removes a variable from the context
func (*Scenario) DeleteContextAs ¶
Delete a variable in the context Gets the "as" parameter from the params map, then builds the name of the variable If "as" is not set, the name of the variable will be <defprefix>.<name> Else, the prefix will be the value of the "as" parameter If the "as" parameter is an empty string, then the name of the variable will be <name> (without prefix)
func (*Scenario) DeleteContextRegex ¶
Removes variables matching a regex from the context
func (*Scenario) DoCleanup ¶
func (s *Scenario) DoCleanup()
Calls the cleanup functions set by the modules, if any
func (*Scenario) ExpandList ¶
Replace the values of the variables in a list
func (*Scenario) ExpandString ¶
Replace the value of the variable
func (*Scenario) ExtractFunctions ¶
Extracts the functions and put them in the "Functions" map, for later call
func (*Scenario) GetBool ¶
func (s *Scenario) GetBool(params map[string]interface{}, key string, def interface{}) (bool, error)
Get a parameter as boolean. Returns the default value if not found. If the value is not found, and there is no default value, returns an error. If the value is not a string, return an error
func (*Scenario) GetContext ¶
Gets a variable from the context stack
func (*Scenario) GetList ¶
func (s *Scenario) GetList(params map[string]interface{}, key string, def interface{}) ([]interface{}, error)
Get a parameter as list. Returns the default value if not found. If the value is not found, and there is no default value, returns an error. If the value is not a list, return an error
func (*Scenario) GetMap ¶
func (s *Scenario) GetMap(params map[string]interface{}, key string, def interface{}) (map[string]interface{}, error)
Get a parameter as map. Returns the default value if not found. If the value is not found, and there is no default value, or the default value is not a map returns an error. If the value is not a map, return an error
func (*Scenario) GetNumber ¶
func (s *Scenario) GetNumber(params map[string]interface{}, key string, def interface{}) (int, error)
Get a parameter as integer. Returns the default value if not found. If the value is not found, and there is no default value, returns an error. If the value is not a string, return an error
func (*Scenario) GetSteps ¶
func (s *Scenario) GetSteps(params map[string]interface{}, key string, def []map[string]interface{}) ([]map[string]interface{}, error)
Get a parameter as steps (a list of maps). Returns the default value if not found. If the value is not found, and there is no default value, or the default value is not a list of maps returns an error. If the value is not a list of maps, return an error
func (*Scenario) GetString ¶
func (s *Scenario) GetString(params map[string]interface{}, key string, def interface{}) (string, error)
Get a parameter as string. Returns the default value if not found. If the value is not found, and there is no default value, returns an error. If the value is not a string, return an error
func (*Scenario) PutCleanup ¶
A module puts a cleanup function
func (*Scenario) PutContext ¶
Put a variable in the context
func (*Scenario) PutContextAs ¶
func (s *Scenario) PutContextAs(params map[string]interface{}, defprefix string, name string, value interface{}) error
Put a variable in the context Gets the "as" parameter from the params map, then builds the name of the variable If "as" is not set, the name of the variable will be <defprefix>.<name> Else, the prefix will be the value of the "as" parameter If the "as" parameter is an empty string, then the name of the variable will be <name> (without prefix)
func (*Scenario) PutContextCallerFunctio ¶
Put a variable in the context of the caller function
func (*Scenario) RemoveStore ¶
Remove data from the store