scenario

package
v0.0.0-...-37bea82 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

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

func (ContextGetter) Lookup

func (x ContextGetter) Lookup(s string) (string, bool, error)

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

type InlineExecutor

type InlineExecutor struct {
	// contains filtered or unexported fields
}

func NewInlineExecutor

func NewInlineExecutor(s *Scenario) *InlineExecutor

func (InlineExecutor) Lookup

func (x InlineExecutor) Lookup(s string) (string, bool, error)

type Meta

type Meta struct {
	Ext    string
	Params []string
}

type Module

type Module struct{}

func (*Module) Assert_equals

func (module *Module) Assert_equals(params map[string]interface{}, scenario *Scenario) error

func (*Module) Assert_fail

func (module *Module) Assert_fail(params map[string]interface{}, scenario *Scenario) error

func (*Module) Assert_match

func (module *Module) Assert_match(params map[string]interface{}, scenario *Scenario) error

func (*Module) Assert_set

func (module *Module) Assert_set(params map[string]interface{}, scenario *Scenario) error

func (*Module) Call

func (module *Module) Call(params map[string]interface{}, scenario *Scenario) error

func (*Module) Display

func (module *Module) Display(params map[string]interface{}, scenario *Scenario) error

func (*Module) Dump

func (module *Module) Dump(params map[string]interface{}, scenario *Scenario) error

func (*Module) Eval

func (module *Module) Eval(params map[string]interface{}, scenario *Scenario) error

func (*Module) Eval_evalMeta

func (module *Module) Eval_evalMeta() Meta

func (*Module) Http_connect

func (module *Module) Http_connect(params map[string]interface{}, scenario *Scenario) error

Module do to HTTP Connect requests

func (*Module) Http_delete

func (module *Module) Http_delete(params map[string]interface{}, scenario *Scenario) error

Module do to HTTP Delete requests

func (*Module) Http_get

func (module *Module) Http_get(params map[string]interface{}, scenario *Scenario) error

Module do to HTTP Get requests

func (*Module) Http_head

func (module *Module) Http_head(params map[string]interface{}, scenario *Scenario) error

Module do to HTTP Head requests

func (*Module) Http_mock

func (module *Module) Http_mock(params map[string]interface{}, scenario *Scenario) error

func (*Module) Http_options

func (module *Module) Http_options(params map[string]interface{}, scenario *Scenario) error

Module do to HTTP Options requests

func (*Module) Http_patch

func (module *Module) Http_patch(params map[string]interface{}, scenario *Scenario) error

Module do to HTTP Patch requests

func (*Module) Http_post

func (module *Module) Http_post(params map[string]interface{}, scenario *Scenario) error

Module do to HTTP Post requests

func (*Module) Http_put

func (module *Module) Http_put(params map[string]interface{}, scenario *Scenario) error

Module do to HTTP Put requests

func (*Module) Http_shutdownmock

func (module *Module) Http_shutdownmock(params map[string]interface{}, scenario *Scenario) error

Module to shutdown current running mock

func (*Module) Http_trace

func (module *Module) Http_trace(params map[string]interface{}, scenario *Scenario) error

Module do to HTTP Trace requests

func (*Module) Id_initseq

func (module *Module) Id_initseq(params map[string]interface{}, scenario *Scenario) error

func (*Module) Id_seq

func (module *Module) Id_seq(params map[string]interface{}, scenario *Scenario) error

func (*Module) Id_seqMeta

func (module *Module) Id_seqMeta() Meta

func (*Module) Id_uuid

func (module *Module) Id_uuid(params map[string]interface{}, scenario *Scenario) error

func (*Module) Json_check

func (module *Module) Json_check(params map[string]interface{}, scenario *Scenario) error

func (*Module) Json_parse

func (module *Module) Json_parse(params map[string]interface{}, scenario *Scenario) error

func (*Module) Json_parseMeta

func (module *Module) Json_parseMeta() Meta

func (*Module) Kafka_check

func (module *Module) Kafka_check(params map[string]interface{}, scenario *Scenario) error

func (*Module) Kafka_connect

func (module *Module) Kafka_connect(params map[string]interface{}, scenario *Scenario) error

func (*Module) Kafka_consume

func (module *Module) Kafka_consume(params map[string]interface{}, scenario *Scenario) error

func (*Module) Kafka_consumeForever

func (module *Module) Kafka_consumeForever(params map[string]interface{}, scenario *Scenario) error

func (*Module) Kafka_produce

func (module *Module) Kafka_produce(params map[string]interface{}, scenario *Scenario) error

func (*Module) Loop

func (module *Module) Loop(params map[string]interface{}, scenario *Scenario) error

func (*Module) Regex_match

func (module *Module) Regex_match(params map[string]interface{}, scenario *Scenario) error

func (*Module) Regex_matchMeta

func (module *Module) Regex_matchMeta() Meta

func (*Module) Resume

func (module *Module) Resume(params map[string]interface{}, scenario *Scenario) error

Resumes execution

func (*Module) Return

func (module *Module) Return(params map[string]interface{}, scenario *Scenario) error

func (*Module) Skip

func (module *Module) Skip(params map[string]interface{}, scenario *Scenario) error

Skips execution of next steps

func (*Module) Sleep

func (module *Module) Sleep(params map[string]interface{}, scenario *Scenario) error

func (*Module) Sql_connect

func (module *Module) Sql_connect(params map[string]interface{}, scenario *Scenario) error

func (*Module) Sql_drivers

func (module *Module) Sql_drivers(params map[string]interface{}, scenario *Scenario) error

func (*Module) Sql_request

func (module *Module) Sql_request(params map[string]interface{}, scenario *Scenario) error

func (*Module) Title

func (module *Module) Title(params map[string]interface{}, scenario *Scenario) error

func (*Module) Tolower

func (module *Module) Tolower(params map[string]interface{}, scenario *Scenario) error

func (*Module) Toupper

func (module *Module) Toupper(params map[string]interface{}, scenario *Scenario) error

func (*Module) Var

func (module *Module) Var(params map[string]interface{}, scenario *Scenario) error

type ParamQuoter

type ParamQuoter struct {
	Scen *Scenario
}

func (ParamQuoter) Lookup

func (l ParamQuoter) Lookup(s string) (string, bool, error)

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 (s *Scenario) AddVariables(params map[string]interface{}) error

func (*Scenario) CopyVariable

func (s *Scenario) CopyVariable(name string, source *Scenario) error

func (*Scenario) CopyVariables

func (s *Scenario) CopyVariables(source *Scenario) error

Add all the variables from params, excluding builtin variables

func (*Scenario) DeleteContext

func (s *Scenario) DeleteContext(name string)

Removes a variable from the context

func (*Scenario) DeleteContextAs

func (s *Scenario) DeleteContextAs(params map[string]interface{}, defprefix string, name string)

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

func (s *Scenario) DeleteContextRegex(regex string)

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) Exec

func (s *Scenario) Exec(val string, params map[string]interface{}) error

Execute a node. Locates the function in the module, and call it.

func (*Scenario) Expand

func (s *Scenario) Expand(params interface{}) (interface{}, error)

Replace the values

func (*Scenario) ExpandList

func (s *Scenario) ExpandList(params []interface{}) ([]interface{}, error)

Replace the values of the variables in a list

func (*Scenario) ExpandMap

func (s *Scenario) ExpandMap(params map[string]interface{}) (map[string]interface{}, error)

Replace the values of the variables in a map

func (*Scenario) ExpandString

func (s *Scenario) ExpandString(param string) (string, error)

Replace the value of the variable

func (*Scenario) ExtractFunctions

func (s *Scenario) ExtractFunctions(steps []interface{}) error

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

func (s *Scenario) GetContext(name string) (string, bool)

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) GetModule

func (s *Scenario) GetModule() string

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) GetStore

func (s *Scenario) GetStore(name string) interface{}

Get data from the store

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) Meta

func (s *Scenario) Meta(val string) Meta

Gets the meta-informations on a module

func (*Scenario) PutCleanup

func (s *Scenario) PutCleanup(k string, f func(*Scenario) error)

A module puts a cleanup function

func (*Scenario) PutContext

func (s *Scenario) PutContext(name string, value interface{}) error

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

func (s *Scenario) PutContextCallerFunctio(name string, value interface{}) error

Put a variable in the context of the caller function

func (*Scenario) PutStore

func (s *Scenario) PutStore(name string, value interface{})

Put data in the store

func (*Scenario) RemoveStore

func (s *Scenario) RemoveStore(name string)

Remove data from the store

func (*Scenario) Run

func (s *Scenario) Run(scen string) error

func (*Scenario) RunFromRoot

func (s *Scenario) RunFromRoot(scen string) error

func (*Scenario) RunFunction

func (s *Scenario) RunFunction(scen string, fun string) error

func (*Scenario) RunSteps

func (s *Scenario) RunSteps(steps []interface{}) error

type Seq

type Seq struct {
	// contains filtered or unexported fields
}

type Step

type Step struct {
	Origin map[string]interface{}
	Type   string
	Desc   string
	Value  string
	Params map[string]interface{}
	Steps  []interface{}

	M Module
	// contains filtered or unexported fields
}

func NewStep

func NewStep(n map[string]interface{}, s *Scenario) *Step

Construct a new Step from the YAML node

func (*Step) Exec

func (s *Step) Exec() error

func (Step) ToString

func (s Step) ToString() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL