Documentation ¶
Overview ¶
Package schema provides the test scenario data schema for scenarigo.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bind ¶
type Bind struct {
Vars map[string]interface{} `yaml:"vars"`
}
Bind represents bindings of variables.
type Config ¶
type Config struct { SchemaVersion string `yaml:"schemaVersion,omitempty"` Scenarios []string `yaml:"scenarios,omitempty"` PluginDirectory string `yaml:"pluginDirectory,omitempty"` Plugins PluginConfigMap `yaml:"plugins,omitempty"` Output OutputConfig `yaml:"output,omitempty"` // absolute path to the configuration file Root string `yaml:"-"` }
Config represents a configuration.
func LoadConfig ¶
LoadConfig loads a configuration from path.
type Duration ¶
Duration represents the elapsed time.
func (*Duration) MarshalYAML ¶
MarshalYAML implements yaml.BytesMarshaler interface.
func (*Duration) UnmarshalYAML ¶
UnmarshalYAML implements yaml.BytesUnmarshaler interface.
type JSONReportConfig ¶
type JSONReportConfig struct {
Filename string `yaml:"filename,omitempty"`
}
JSONReportConfig represents a JSON report configuration.
type JUnitReportConfig ¶
type JUnitReportConfig struct {
Filename string `yaml:"filename,omitempty"`
}
JUnitReportConfig represents a JUnit report configuration.
type OutputConfig ¶
type OutputConfig struct { Verbose bool `yaml:"verbose,omitempty"` Colored *bool `yaml:"colored,omitempty"` Report ReportConfig `yaml:"report,omitempty"` }
OutputConfig represents a output configuration.
type PluginConfig ¶
type PluginConfig struct { Order int `yaml:"-"` Name string `yaml:"-"` Src string `yaml:"src,omitempty"` }
PluginConfig represents a plugin configuration.
type PluginConfigMap ¶
type PluginConfigMap map[string]PluginConfig
PluginConfigMap represents a plugin configurations.
func (PluginConfigMap) MarshalYAML ¶
func (m PluginConfigMap) MarshalYAML() ([]byte, error)
func (PluginConfigMap) ToSlice ¶
func (m PluginConfigMap) ToSlice() []PluginConfig
ToSlice returns m as a slice.
func (*PluginConfigMap) UnmarshalYAML ¶
func (m *PluginConfigMap) UnmarshalYAML(b []byte) error
type ReportConfig ¶
type ReportConfig struct { JSON JSONReportConfig `yaml:"json,omitempty"` JUnit JUnitReportConfig `yaml:"junit,omitempty"` }
ReportConfig represents a report configuration.
type RetryPolicy ¶
type RetryPolicy struct { Constant *RetryPolicyConstant `yaml:"constant"` Exponential *RetryPolicyExponential `yaml:"exponential"` }
RetryPolicy represents a retry policy.
type RetryPolicyConstant ¶
type RetryPolicyConstant struct { Interval *Duration `yaml:"interval"` // default value is 1s MaxRetries *int `yaml:"maxRetries"` // default value is 5, 0 means forever MaxElapsedTime *Duration `yaml:"maxElapsedTime"` // default value is 0, 0 means forever }
RetryPolicyConstant represents a constant retry policy.
type RetryPolicyExponential ¶
type RetryPolicyExponential struct { InitialInterval *Duration `yaml:"initialInterval"` // default value is 500ms Factor *float64 `yaml:"factor"` // default value is 1.5 JitterFactor *float64 `yaml:"jitterFactor"` // default value is 0.5 MaxInterval *Duration `yaml:"maxInterval"` // default value is 15min MaxRetries *int `yaml:"maxRetries"` // default value is 5, 0 means forever MaxElapsedTime *Duration `yaml:"maxElapsedTime"` // default value is 0, 0 means forever }
RetryPolicyExponential represents a exponential retry policy.
type Scenario ¶
type Scenario struct { Title string `yaml:"title,omitempty"` Description string `yaml:"description,omitempty"` Plugins map[string]string `yaml:"plugins,omitempty"` Vars map[string]interface{} `yaml:"vars,omitempty"` Steps []*Step `yaml:"steps,omitempty"` // The strict YAML decoder fails to decode if finds an unknown field. // Anchors is the field for enabling to define YAML anchors by avoiding the error. // This field doesn't need to hold some data because anchors expand by the decoder. Anchors anchors `yaml:"anchors,omitempty"` Node ast.Node `yaml:"-"` // contains filtered or unexported fields }
Scenario represents a test scenario.
func LoadScenarios ¶
LoadScenarios loads test scenarios from path.
func LoadScenariosFromReader ¶
LoadScenariosFromReader loads test scenarios with io.Reader.
type Step ¶
type Step struct { Title string `yaml:"title,omitempty"` Description string `yaml:"description,omitempty"` Vars map[string]interface{} `yaml:"vars,omitempty"` Protocol string `yaml:"protocol,omitempty"` Request protocol.Invoker `yaml:"request,omitempty"` Expect protocol.AssertionBuilder `yaml:"expect,omitempty"` Include string `yaml:"include,omitempty"` Ref interface{} `yaml:"ref,omitempty"` Bind Bind `yaml:"bind,omitempty"` Retry *RetryPolicy `yaml:"retry,omitempty"` Timeout *Duration `yaml:"timeout,omitempty"` }
Step represents a step of scenario.
func (*Step) UnmarshalYAML ¶
UnmarshalYAML implements yaml.Unmarshaler interface.