analyser

package
v0.0.0-...-1dd1f65 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package analyser represents the stage of the tester that takes a plan, performs various statistics on it, and outputs reports.

Index

Constants

This section is empty.

Variables

View Source
var ErrBadStatus = errors.New("at least one subject reported a bad status")

ErrBadStatus is the error reported when the analyser is asked to error on a bad status, and one arrives.

View Source
var ErrObserverNil = errors.New("observer nil")

ErrObserverNil occurs if we pass a nil Observer to ObserveWith.

Functions

func OnAnalysis

func OnAnalysis(a analysis.Analysis, obs ...Observer)

OnAnalysis sends OnAnalysis to every instance observer in obs.

Types

type Analyser

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

Analyser represents the state of the plan analyser stage.

func New

func New(opts ...Option) (*Analyser, error)

New constructs a new analyser stage on plan p, with options opts.

func (*Analyser) Close

func (*Analyser) Close() error

Close does nothing.

func (*Analyser) Run

func (a *Analyser) Run(ctx context.Context, p *plan.Plan) (*plan.Plan, error)

Run runs the analyser on the plan p, outputting to the configured output writer.

func (*Analyser) Stage

func (*Analyser) Stage() stage.Stage

Stage returns the appropriate stage information for the analyser.

type Observer

type Observer interface {
	// OnAnalysis lets the observer know that the current plan has been analysed and the results are in a.
	OnAnalysis(a analysis.Analysis)
}

Observer represents the observer interface for the analyser stage.

type Option

type Option func(*Analyser) error

Option is the type of options to the analyser stage constructor.

func Analysis

func Analysis(opts ...analysis.Option) Option

Analysis sets some analysis options.

func ErrorOnBadStatus

func ErrorOnBadStatus(on bool) Option

ErrorOnBadStatus makes the analyser fail if it observed any 'bad' statuses, if set to true.

func ObserveSaveWith

func ObserveSaveWith(obs ...saver.Observer) Option

ObserveSaveWith adds each observer in obs to the observer set for saving.

func ObserveWith

func ObserveWith(obs ...Observer) Option

ObserveWith adds each observer in obs to the observer set for analysing.

func Options

func Options(opts ...Option) Option

Options applies each option in opts in turn.

func SaveToPathset

func SaveToPathset(ps *saver.Pathset) Option

SaveToPathset makes this analyser stage save to the given pathset. This can be nil, in which case saving is disabled.

Directories

Path Synopsis
Package csvdump handles outputting of analysis data as CSVs.
Package csvdump handles outputting of analysis data as CSVs.
Package pretty provides a pretty-printer for analyses.
Package pretty provides a pretty-printer for analyses.
Package saver contains the part of the analyser that uses the analyser to save failing tests.
Package saver contains the part of the analyser that uses the analyser to save failing tests.

Jump to

Keyboard shortcuts

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