coreengine

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package coreengine contains the types and functions responsible for managing tests and test execution. This is the primary entry point to the core of the application and should be utilised by the probr library to create, execute and report on tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GodogProbeHandler added in v0.3.0

func GodogProbeHandler(probe *GodogProbe) (int, *bytes.Buffer, error)

GodogProbeHandler is a general implmentation of ProbeHandlerFunc. Based on the output type, the test will either be executed using an in-memory or file output. In both cases, the handler uses the data supplied in GodogProbe to call the underlying GoDog test suite.

func LogScenarioEnd added in v0.3.0

func LogScenarioEnd(s *godog.Scenario)

LogScenarioEnd logs the name and tags associtated with the supplied scenario.

func LogScenarioStart added in v0.3.0

func LogScenarioStart(s *godog.Scenario)

LogScenarioStart logs the name and tags associtated with the supplied scenario.

Types

type GodogProbe added in v0.3.0

type GodogProbe struct {
	ProbeDescriptor     *ProbeDescriptor
	ProbeInitializer    func(*godog.TestSuiteContext)
	ScenarioInitializer func(*godog.ScenarioContext)
	FeaturePath         string
	Status              *ProbeStatus `json:"status,omitempty"`
	Results             *bytes.Buffer
}

GodogProbe encapsulates the specific data that GoDog feature based tests require in order to run. This structure will be passed to the test handler callback.

type Group

type Group int

Group type describes the group to which the test belongs, e.g. kubernetes, clouddriver, coreengine, etc.

const (
	Kubernetes Group = iota
	CloudDriver
	CoreEngine
)

Group type enumeration

func (Group) String

func (g Group) String() string

type ProbeDescriptor added in v0.3.0

type ProbeDescriptor struct {
	Group Group  `json:"group,omitempty"`
	Name  string `json:"name,omitempty"`
}

ProbeDescriptor describes the specific test case and includes name and group.

type ProbeHandlerFunc added in v0.3.0

type ProbeHandlerFunc func(t *GodogProbe) (int, *bytes.Buffer, error)

ProbeHandlerFunc describes a callback that should be implemented by test cases in order for ProbeRunner to be able to execute the test case.

type ProbeRunner added in v0.3.0

type ProbeRunner interface {
	RunProbe(t *GodogProbe) error
}

ProbeRunner describes the interface that should be implemented to support the execution of tests.

type ProbeStatus added in v0.3.0

type ProbeStatus int

ProbeStatus type describes the status of the test, e.g. Pending, Running, CompleteSuccess, CompleteFail and Error

const (
	Pending ProbeStatus = iota
	Running
	CompleteSuccess
	CompleteFail
	Error
	Excluded
)

ProbeStatus enumeration for the ProbeStatus type.

func (ProbeStatus) String added in v0.3.0

func (s ProbeStatus) String() string

type ProbeStore added in v0.3.0

type ProbeStore struct {
	Probes       map[string]*GodogProbe
	FailedProbes map[ProbeStatus]*GodogProbe
	Lock         sync.RWMutex
}

ProbeStore maintains a collection of probes to be run and their status. FailedProbes is an explicit collection of failed probes.

func NewProbeStore added in v0.3.0

func NewProbeStore() *ProbeStore

NewProbeStore creates a new object to store GodogProbes

func (*ProbeStore) AddProbe added in v0.3.0

func (ps *ProbeStore) AddProbe(probe *GodogProbe)

AddProbe provided GodogProbe to the ProbeStore.

func (*ProbeStore) ExecAllProbes added in v0.3.0

func (ps *ProbeStore) ExecAllProbes() (int, error)

ExecAllProbes executes all tests that are present in the ProbeStore.

func (*ProbeStore) ExecProbe added in v0.3.0

func (ps *ProbeStore) ExecProbe(name string) (int, error)

ExecProbe executes the test identified by the specified name.

func (*ProbeStore) GetProbe added in v0.3.0

func (ps *ProbeStore) GetProbe(name string) (*GodogProbe, error)

GetProbe returns the test identified by the given name.

func (*ProbeStore) RunProbe added in v0.3.0

func (ps *ProbeStore) RunProbe(probe *GodogProbe) (int, error)

RunProbe runs the test case described by the supplied Probe. It looks in it's test register (the handlers global variable) for an entry with the same ProbeDescriptor as the supplied test. If found, it uses the provided GodogProbe

Jump to

Keyboard shortcuts

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