Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Assertion ¶
type Assertion struct { Comparison Comparison `json:"comparison"` Value string `json:"value"` Source Source `json:"Source"` Property string `json:"property,omitempty"` }
An Assertions defines one expected result
type Comparison ¶
type Comparison int
const ( EqualNumber Comparison = iota //equal_number Equal //equal NotEqual //not_equal IsANumber //is_a_number IsLessThan //is_less_than IsLessThanOrEqual //is_less_than_or_equals IsGreaterThan //is_greater_than IsGreaterThanOrEqual //is_greater_than_or_equal Contains //contains DoesNotContain //does_not_contain NotEmpty //not_empty Empty //empty IsNull //is_null HasValue //has_value HasKey //has_key )
func ComparisonString ¶
func ComparisonString(s string) (Comparison, error)
ComparisonString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func ComparisonValues ¶
func ComparisonValues() []Comparison
ComparisonValues returns all values of the enum
func (Comparison) GetMessage ¶
func (i Comparison) GetMessage() comparisonMessage
func (Comparison) IsAComparison ¶
func (i Comparison) IsAComparison() bool
IsAComparison returns "true" if the value is listed in the enum definition. "false" otherwise
func (Comparison) MarshalJSON ¶
func (i Comparison) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for Comparison
func (Comparison) String ¶
func (i Comparison) String() string
func (*Comparison) UnmarshalJSON ¶
func (i *Comparison) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for Comparison
type Response ¶
type ResultAssertion ¶
type ResultAssertion struct { Success bool `json:"success"` Source Source `json:"source,omitempty"` Property string `json:"property,omitempty"` Err error `json:"error,omitempty"` Message string `json:"message,omitempty"` }
func NewResultAssertion ¶
func NewResultAssertion(comparison Comparison, success bool, v ...interface{}) ResultAssertion
func (*ResultAssertion) Print ¶
func (ar *ResultAssertion) Print()
type ResultStep ¶
type ResultStep struct { // Common result for every step types StepType StepType `json:"step_type"` StepTime time.Duration `json:"step_time,omitempty"` // Specific for type request Request rest.Request `json:"request,omitempty"` Response Response `json:"response,omitempty"` Assertions []ResultAssertion `json:"assertions,omitempty"` VariablesApplied []ResultVariable `json:"variables_applied,omitempty"` VariablesCreated []ResultVariable `json:"variables_created,omitempty"` }
func (*ResultStep) IsSuccess ¶
func (step *ResultStep) IsSuccess() bool
IsSuccess check if the step was a success or not.
type ResultVariable ¶
type ResultVariable struct { Key string `json:"name,omitempty"` NewValue string `json:"value,omitempty"` Err error `json:"error,omitempty"` Type ResultVariableType `json:"-"` }
func (*ResultVariable) Print ¶
func (rv *ResultVariable) Print()
type ResultVariableType ¶
type ResultVariableType int
const ( Created ResultVariableType = iota //Variable Used //Set )
func ResultVariableTypeString ¶
func ResultVariableTypeString(s string) (ResultVariableType, error)
ResultVariableTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func ResultVariableTypeValues ¶
func ResultVariableTypeValues() []ResultVariableType
ResultVariableTypeValues returns all values of the enum
func (ResultVariableType) IsAResultVariableType ¶
func (i ResultVariableType) IsAResultVariableType() bool
IsAResultVariableType returns "true" if the value is listed in the enum definition. "false" otherwise
func (ResultVariableType) MarshalJSON ¶
func (i ResultVariableType) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for ResultVariableType
func (ResultVariableType) String ¶
func (i ResultVariableType) String() string
func (*ResultVariableType) UnmarshalJSON ¶
func (i *ResultVariableType) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for ResultVariableType
type Scenario ¶
type Scenario struct { Name string `json:"name"` Version string `json:"version"` ExportedAt int `json:"exported_at"` Steps []Step `json:"steps"` Description string `json:"description"` }
func InitScenarioFromFile ¶
InitScenarioFromFile creates a scenario from the input file.
type ScenarioResult ¶
type ScenarioResult struct { Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` Description string `json:"description,omitempty"` StepResults []ResultStep `json:"step_results,omitempty"` }
func (*ScenarioResult) IsSuccess ¶
func (scenario *ScenarioResult) IsSuccess() bool
IsSuccess check if the scenario was success.
type Source ¶
type Source int
func SourceString ¶
SourceString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func (Source) IsASource ¶
IsASource returns "true" if the value is listed in the enum definition. "false" otherwise
func (Source) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for Source
func (*Source) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for Source
type Step ¶
type Step struct { StepType StepType `json:"step_type"` URL string `json:"Url,omitempty"` Variables []Variable `json:"variables,omitempty"` Headers map[string][]string `json:"headers,omitempty"` Assertions []Assertion `json:"assertions,omitempty"` Method string `json:"method,omitempty"` Duration int `json:"duration,omitempty"` Body string `json:"body,omitempty"` Skipped bool `json:"skipped,omitempty"` }
type StepType ¶
type StepType int
func StepTypeString ¶
StepTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func StepTypeValues ¶
func StepTypeValues() []StepType
StepTypeValues returns all values of the enum
func (StepType) IsAStepType ¶
IsAStepType returns "true" if the value is listed in the enum definition. "false" otherwise
func (StepType) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for StepType
func (*StepType) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for StepType