result

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

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

Result is returned from a `Evaluable.Eval` execution. It serves two purposes:

1) to return an error, if any, from the Eval execution. This error will *always* be a `gdterrors.RuntimeError`. Failed assertions are not errors. 2) to pass back information about the Run that can be injected into the context's `PriorRun` cache. Some plugins, e.g. the gdt-http plugin, use cached data from a previous run in order to construct current Run fixtures. In the case of the gdt=http plugin, the previous `nethttp.Response` is returned in the Result and the `Scenario.Run` method injects that information into the context that is supplied to the next Spec's `Run`.

func New

func New(mods ...ResultModifier) *Result

New returns a new Result

func (*Result) Data

func (r *Result) Data() map[string]interface{}

Data returns the raw run data saved in the result

func (*Result) Failed added in v1.1.0

func (r *Result) Failed() bool

Failed returns true if any assertion failed during Eval(), false otherwise.

func (*Result) Failures added in v1.1.0

func (r *Result) Failures() []error

Failures returns the collection of assertion failures that occurred during Eval().

func (*Result) HasData

func (r *Result) HasData() bool

HasData returns true if any of the run data has been set, false otherwise.

func (*Result) HasRuntimeError added in v1.1.0

func (r *Result) HasRuntimeError() bool

HasRuntimeError returns true if the Eval() returned a runtime error, false otherwise.

func (*Result) RuntimeError added in v1.1.0

func (r *Result) RuntimeError() error

RuntimeError returns the runtime error

func (*Result) SetData

func (r *Result) SetData(
	key string,
	val interface{},
)

SetData sets a value in the result's run data cache.

func (*Result) SetFailures added in v1.1.0

func (r *Result) SetFailures(failures ...error)

SetFailures sets the result's collection of assertion failures.

type ResultModifier

type ResultModifier func(*Result)

func WithData

func WithData(key string, val interface{}) ResultModifier

WithData modifies the Result with the supplied run data key and value

func WithFailures added in v1.1.0

func WithFailures(failures ...error) ResultModifier

WithFailures modifies the Result the supplied collection of assertion failures

func WithRuntimeError added in v1.1.0

func WithRuntimeError(err error) ResultModifier

WithRuntimeError modifies the Result with the supplied error

Jump to

Keyboard shortcuts

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