probeengine

package
v0.0.33 Latest Latest
Warning

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

Go to latest
Published: May 11, 2021 License: Apache-2.0 Imports: 15 Imported by: 4

Documentation

Overview

Package probeengine 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 CleanupTmp

func CleanupTmp()

CleanupTmp is used to dispose of any temp resources used during execution

func GetAllProbeResults

func GetAllProbeResults(ps *ProbeStore) (allResults map[string]string)

GetAllProbeResults maps ProbeStore results to strings Designed for use with in-memory output, such as for an API runtime

func GetFeaturePath

func GetFeaturePath(path ...string) string

GetFeaturePath parses a list of strings into a standardized file path for the BDD ".feature" files TODO: refactor this to use GetFilePath

func GetFilePath

func GetFilePath(path ...string) (filePath string)

GetFilePath parses a list of strings into a standardized file path. The filename should be in the final element of path

func GodogProbeHandler

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

GodogProbeHandler is a wrapper to allow for multiple probe handlers in the future

func LogScenarioEnd

func LogScenarioEnd(s *godog.Scenario)

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

func LogScenarioStart

func LogScenarioStart(s *godog.Scenario)

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

Types

type GodogProbe

type GodogProbe struct {
	Name                string
	Pack                string
	ProbeInitializer    func(*godog.TestSuiteContext)
	ScenarioInitializer func(*godog.ScenarioContext)
	FeaturePath         string
	Status              *ProbeStatus
	Results             *bytes.Buffer
	Tags                string
}

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 Probe

type Probe interface {
	ProbeInitialize(*godog.TestSuiteContext)
	ScenarioInitialize(*godog.ScenarioContext)
	Name() string
	Path() string
}

Probe is an interface used by probes that are to be exported from any service pack

type ProbeHandlerFunc

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

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

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

type ProbeStatus

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

func (s ProbeStatus) String() string

type ProbeStore

type ProbeStore struct {
	Name         string
	Probes       map[string]*GodogProbe
	FailedProbes map[ProbeStatus]*GodogProbe
	Lock         sync.RWMutex
	Summary      *audit.SummaryState
	Tags         string
}

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

func NewProbeStore

func NewProbeStore(name string, tags string, summaryState *audit.SummaryState) *ProbeStore

NewProbeStore creates a new object to store GodogProbes

func (*ProbeStore) AddProbe

func (ps *ProbeStore) AddProbe(preParsedProbe Probe)

AddProbe provided GodogProbe to the ProbeStore.

func (*ProbeStore) ExecAllProbes

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

ExecAllProbes executes all tests that are present in the ProbeStore.

func (*ProbeStore) ExecProbe

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

ExecProbe executes the test identified by the specified name.

func (*ProbeStore) GetProbe

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

GetProbe returns the test identified by the given name.

func (*ProbeStore) RunAllProbes added in v0.0.21

func (ps *ProbeStore) RunAllProbes(probes []Probe) (int, error)

RunAllProbes retrieves and executes all probes that have been included

func (*ProbeStore) RunProbe

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

RunProbe runs the test cases described by the supplied Probe

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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