suite

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Suite

type Suite struct {
	// Path is the filepath to the test suite directory.
	Path string `yaml:"-"`
	// Name is the short name for the test suite. If empty, defaults to Path.
	Name string `yaml:"name,omitempty"`
	// Description is a description of the tests contained in the test suite.
	Description string `yaml:"description,omitempty"`
	// Defaults contains any default configuration values for test cases
	// contained within the test suite.
	//
	// 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 suite's test
	// cases depends on.
	Require []string `yaml:"require,omitempty"`
	// Scenarios is a collection of test scenarios in this test suite
	Scenarios []*scenario.Scenario `yaml:"-"`
}

Suite contains zero or more scenarios, one for each YAML file representing a Scenario in a given directory

func FromDir

func FromDir(
	dirPath string,
	mods ...SuiteModifier,
) (*Suite, error)

FromDir reads the supplied directory path and returns a Suite representing the suite of test scenarios in that directory.

func FromScenario added in v1.1.0

func FromScenario(s *scenario.Scenario) *Suite

FromScenario encapsulates a given scenario in a fresh suite and returns it.

func New

func New(mods ...SuiteModifier) *Suite

New returns a new Suite

func (*Suite) Append

func (s *Suite) Append(sc *scenario.Scenario)

Append appends a test element to the test suite

func (*Suite) Run

func (s *Suite) Run(ctx context.Context, t *testing.T) error

Run executes the tests in the test case

type SuiteModifier

type SuiteModifier func(s *Suite)

SuiteModifier sets some value on the test suite

func WithDefaults

func WithDefaults(defaults map[string]interface{}) SuiteModifier

WithDefaults sets a test suite's Defaults attribute

func WithDescription

func WithDescription(description string) SuiteModifier

WithDescription sets a test suite's Description attribute

func WithName

func WithName(name string) SuiteModifier

WithName sets a test suite's Name attribute

func WithPath

func WithPath(path string) SuiteModifier

WithPath sets a test suite's Path attribute

func WithRequires

func WithRequires(require []string) SuiteModifier

WithRequires sets a test suite's Requires attribute

Jump to

Keyboard shortcuts

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