schema

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

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 added in v0.7.0

type Config struct {
	SchemaVersion   string                  `yaml:"schemaVersion,omitempty"`
	Scenarios       []string                `yaml:"scenarios,omitempty"`
	PluginDirectory string                  `yaml:"pluginDirectory,omitempty"`
	Plugins         map[string]PluginConfig `yaml:"plugins,omitempty"`
	Output          OutputConfig            `yaml:"output,omitempty"`

	// absolute path to the configuration file
	Root string `yaml:"-"`
}

Config represents a configuration.

func LoadConfig added in v0.7.0

func LoadConfig(path string, colored bool) (*Config, error)

LoadConfig loads a configuration from path.

type JSONReportConfig added in v0.7.0

type JSONReportConfig struct {
	Filename string `yaml:"filename,omitempty"`
}

JSONReportConfig represents a JSON report configuration.

type JUnitReportConfig added in v0.7.0

type JUnitReportConfig struct {
	Filename string `yaml:"filename,omitempty"`
}

JUnitReportConfig represents a JUnit report configuration.

type OutputConfig added in v0.7.0

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 added in v0.9.0

type PluginConfig struct {
	Src string `yaml:"src,omitempty"`
}

PluginConfig represents a plugin configuration.

type ReportConfig added in v0.7.0

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.

func (*RetryPolicy) Build

func (p *RetryPolicy) Build() (backoff.Policy, error)

Build returns p as backoff.Policy. If p is nil, Build returns the policy which never retry.

type RetryPolicyConstant

type RetryPolicyConstant struct {
	Interval       string  `yaml:"interval"`
	MaxElapsedTime *string `yaml:"maxElapsedTime"`
	MaxRetries     *int    `yaml:"maxRetries"`
}

RetryPolicyConstant represents a constant retry policy.

func (*RetryPolicyConstant) Build

func (p *RetryPolicyConstant) Build() (backoff.Policy, error)

Build returns p as backoff.Policy.

type RetryPolicyExponential

type RetryPolicyExponential struct {
	InitialInterval *string  `yaml:"initialInterval"`
	Factor          *float64 `yaml:"factor"`
	JitterFactor    *float64 `yaml:"jitterFactor"`
	MaxInterval     *string  `yaml:"maxInterval"`
	MaxElapsedTime  *string  `yaml:"maxElapsedTime"`
	MaxRetries      *int     `yaml:"maxRetries"`
}

RetryPolicyExponential represents a exponential retry policy.

func (*RetryPolicyExponential) Build

Build returns p as backoff.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

func LoadScenarios(path string) ([]*Scenario, error)

LoadScenarios loads test scenarios from path.

func LoadScenariosFromReader added in v0.6.0

func LoadScenariosFromReader(r io.Reader) ([]*Scenario, error)

LoadScenariosFromReader loads test scenarios with io.Reader.

func (*Scenario) Filepath

func (s *Scenario) Filepath() string

Filepath returns YAML filepath of s.

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"`
}

Step represents a step of scenario.

func (*Step) UnmarshalYAML

func (s *Step) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler interface.

Jump to

Keyboard shortcuts

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