Documentation ¶
Index ¶
- type Result
- func (r *Result) Data() map[string]interface{}
- func (r *Result) Failed() bool
- func (r *Result) Failures() []error
- func (r *Result) HasData() bool
- func (r *Result) HasRuntimeError() bool
- func (r *Result) RuntimeError() error
- func (r *Result) SetData(key string, val interface{})
- func (r *Result) SetFailures(failures ...error)
- type ResultModifier
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 (*Result) Failed ¶ added in v1.1.0
Failed returns true if any assertion failed during Eval(), false otherwise.
func (*Result) Failures ¶ added in v1.1.0
Failures returns the collection of assertion failures that occurred during Eval().
func (*Result) HasRuntimeError ¶ added in v1.1.0
HasRuntimeError returns true if the Eval() returned a runtime error, false otherwise.
func (*Result) RuntimeError ¶ added in v1.1.0
RuntimeError returns the runtime error
func (*Result) SetFailures ¶ added in v1.1.0
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