acceptance

package
v0.16.3 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2020 License: BSD-3-Clause Imports: 26 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Case added in v0.15.0

func Case(name string, fn func())

Case represents a test case of a feature.

func Configure

func Configure(cfg Configuration) error

Configure configures all the values needed to run the acceptance tests. This should be called before run.

func Default

func Default(fn func())

Default represents the default test case of a feature.

func ErrorCase

func ErrorCase(name string, fn func())

ErrorCase represents an error case for a feature. These are optionally tested based on command line flags.

Failure of an error case does not prevent further error cases or RunsInside features from running.

func FatalErr

func FatalErr(format string, args ...interface{}) error

FatalErr will cause a feature test to fail, and abort running the rest of it.

func Infof

func Infof(format string, args ...interface{})

Infof prints the given format string and args at the appropriate indentation level, if the logger is at info level or above.

func Infoln

func Infoln(args ...interface{})

Infoln prints the given args at the appropriate indentation level, if the logger is at info level or above.

func Run

func Run(ctx context.Context, runErrorCases bool, exclude []string) bool

Run runs the acceptance tests for all features, less the ones with labels in exclude.

run returns a bool indicating success or failure

func SetLogLevel

func SetLogLevel(level LogLevel)

SetLogLevel configures the log level for the duration of an acceptance test run.

func Validate

func Validate(ctx context.Context, cctx *cli.Context, exclude []string) []error

Validate checks if the test run has all the required information it needs to run the tests.

Valid returns a slice of unique errors where a feature is missing a required testing parameter or setting.

Types

type Configuration added in v0.13.0

type Configuration struct {
	API              *grafton.Client
	UnauthorizedAPI  *grafton.Client
	Product          string
	Region           string
	Plan             string
	PlanFeatures     manifold.FeatureMap
	NewPlan          string
	NewPlanFeatures  manifold.FeatureMap
	ClientID         string
	ClientSecret     string
	Port             uint
	CallbackTimeout  string
	ResourceMeasures string
	Credential       string
}

Configuration defines the config options for the acceptance tests

type FeatureFunc

type FeatureFunc func(ctx context.Context)

FeatureFunc is the func type run to test features

type FeatureImpl

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

FeatureImpl is a feature implementation.

func Feature

func Feature(label, name string, fn FeatureFunc) *FeatureImpl

Feature represents a testable feature

func (*FeatureImpl) NeedsFlag

func (f *FeatureImpl) NeedsFlag(flag string) bool

NeedsFlag checks if a Feature Implementation needs a specific flag or not.

func (*FeatureImpl) RequiredFlags

func (f *FeatureImpl) RequiredFlags(flags ...string) interface{}

RequiredFlags marks a set of flags required for a feature. We will use this to see that all flags are provided when executing a test.

func (*FeatureImpl) RunsBefore

func (f *FeatureImpl) RunsBefore(label string) interface{}

RunsBefore expresses a dependency between two features. A feature that runs before another feature will execute its tests, and tear down before the other is run.

func (*FeatureImpl) RunsInside

func (f *FeatureImpl) RunsInside(label string) interface{}

RunsInside expresses a dependency between two features. A feature that runs inside another feature will execute its tests, and tear down after the other is run, but before it is torn down.

func (*FeatureImpl) TearDown

func (f *FeatureImpl) TearDown(name string, fn FeatureFunc) interface{}

TearDown represents the optional teardown step for a feature

type LogLevel

type LogLevel string

LogLevel is the type for setting our informational log level, irrespective of test results.

const (
	LogOff     LogLevel = "off"
	LogInfo    LogLevel = "info"
	LogVerbose LogLevel = "verbose"
)

Log Levels the user can set.

Jump to

Keyboard shortcuts

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