Documentation
¶
Index ¶
Constants ¶
const ( // DefaultsKey is the key within the Defaults collection for // scenario defaults. DefaultsKey = "gdt.scenario" )
Variables ¶
This section is empty.
Functions ¶
func FromBytes ¶
func FromBytes( contents []byte, mods ...ScenarioModifier, ) (gdttypes.Runnable, error)
FromBytes returns a Scenario after parsing the supplied contents
func FromReader ¶
FromReader parses the supplied io.Reader and returns a Scenario representing the contents in the reader. Returns an error if any syntax or validation failed
Types ¶
type Defaults ¶
type Defaults struct {
// Timeout has fields that represent the default timeout behaviour and
// expectations to use for test specs in the scenario.
Timeout *gdttypes.Timeout `yaml:"timeout,omitempty"`
}
Defaults is the scenario's defaults collection
type Scenario ¶
type Scenario struct {
// Path is the filepath to the test case.
Path string `yaml:"-"`
// Name is the short name for the test case. If empty, defaults to the base
// filename in Path.
Name string `yaml:"name,omitempty"`
// Description is a description of the tests contained in the test case.
Description string `yaml:"description,omitempty"`
// Defaults contains any default configuration values for test specs
// contained within the test scenario.
//
// During parsing, plugins are handed this raw data and asked to interpret
// it into known configuration values for that plugin.
Defaults map[string]interface{} `yaml:"defaults,omitempty"`
// Require specifies an ordered list of fixtures the test case depends on.
Require []string `yaml:"require,omitempty"`
// Tests is the collection of test units in this test case. These will be
// the fully parsed and materialized plugin Spec structs.
Tests []gdttypes.TestUnit `yaml:"tests,omitempty"`
}
Scenario is a generalized gdt test case file. It contains a set of Runnable test units.
type ScenarioModifier ¶
type ScenarioModifier func(s *Scenario)
ScenarioModifier sets some value on the test scenario
func WithDefaults ¶
func WithDefaults(defaults map[string]interface{}) ScenarioModifier
WithDefaults sets a test scenario's Defaults attribute
func WithDescription ¶
func WithDescription(description string) ScenarioModifier
WithDescription sets a test scenario's Description attribute
func WithName ¶
func WithName(name string) ScenarioModifier
WithName sets a test scenario's Name attribute
func WithPath ¶
func WithPath(path string) ScenarioModifier
WithPath sets a test scenario's Path attribute
func WithRequires ¶
func WithRequires(require []string) ScenarioModifier
WithRequires sets a test scenario's Requires attribute