Documentation ¶
Overview ¶
Package http contains the HTTP/REST test scenario implementation.
Index ¶
- Constants
- func AssertionMethod(method string) assertionMethod
- type Assertion
- type AssertionError
- type Client
- type ErrInvalidPathReplacement
- type ErrJSONKeyNotFound
- type ErrNonExecutedStep
- type ExecuteResult
- type ExecuteStepResult
- type Executor
- type Header
- type InputReplacement
- type Opts
- type Request
- type RequestResult
- type Retry
- type Scenario
- type Step
- type Validation
Constants ¶
const ( AssertionMethodEqual assertionMethod = "equal" AssertionMethodRegex assertionMethod = "regex" AssertionMethodNotEmpty assertionMethod = "not_empty" )
Different assertion methods.
const ( ValidationBody validationType = "body" ValidationStatus validationType = "status" ValidationHeaders validationType = "headers" )
Different validation types.
Variables ¶
This section is empty.
Functions ¶
func AssertionMethod ¶
func AssertionMethod(method string) assertionMethod
AssertionMethod returns an assertion method for a given string.
Types ¶
type AssertionError ¶
AssertionError is an error for when an assertion fails.
func (AssertionError) Error ¶
func (e AssertionError) Error() string
type ErrInvalidPathReplacement ¶
type ErrInvalidPathReplacement struct {
// contains filtered or unexported fields
}
ErrInvalidPathReplacement is an error for when a replacement json path is not found in the defined step's JSON output.
func (ErrInvalidPathReplacement) Error ¶
func (e ErrInvalidPathReplacement) Error() string
type ErrJSONKeyNotFound ¶
type ErrJSONKeyNotFound struct {
StepName, Key, Body string
}
ErrJSONKeyNotFound is an error for when a JSON key for dynamic input replacement is not found in the defined step's JSON output.
func (ErrJSONKeyNotFound) Error ¶
func (e ErrJSONKeyNotFound) Error() string
type ErrNonExecutedStep ¶
type ErrNonExecutedStep struct {
StepName, NonExecutedStepName string
}
ErrNonExecutedStep is an error for when a step is not executed but is required for dynamic input replacement.
func (ErrNonExecutedStep) Error ¶
func (e ErrNonExecutedStep) Error() string
type ExecuteResult ¶
type ExecuteResult struct { Name string TotalExecutionTime time.Duration TotalAssertions int StepResults []*ExecuteStepResult Success bool }
ExecuteResult is the result of executing a scenario.
type ExecuteStepResult ¶
type ExecuteStepResult struct { Name string Assertions int URL string RequestDuration time.Duration Duration time.Duration Retries int Success bool }
ExecuteStepResult is the result of executing a step.
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor is the http test executor implementation.
func NewExecutor ¶
NewExecutor creates a new HTTP test scenario executor.
type InputReplacement ¶
InputReplacement is a struct for replacing dynamic inputs in a step.
type Opts ¶
type Opts func(*options)
Opts is a function for setting options on a scenario.
func WithHTTPClient ¶
WithHTTPClient sets the HTTP client to use for the scenario.
func WithLogger ¶
WithLogger sets the logger to use for the scenario.
type RequestResult ¶
RequestResult represents the result of an HTTP request.
type Step ¶
type Step struct { Name string Request *Request Validation *Validation RequestResult *RequestResult IsExecuted bool Retry *Retry }
Step represents a step in a scenario.
type Validation ¶
Validation represents the validation of a step.