Documentation
¶
Index ¶
- func MarshalResult(v interface{}) map[string]interface{}
- type AssertionResult
- type Context
- func (c *Context) All() map[string]interface{}
- func (c *Context) EvalBool(expression string) (bool, error)
- func (c *Context) EvalExpr(expression string) (interface{}, error)
- func (c *Context) Get(key string) (interface{}, bool)
- func (c *Context) ResolveInterface(v interface{}) interface{}
- func (c *Context) ResolveString(input string) string
- func (c *Context) SaveFromResult(saveMap map[string]string, result map[string]interface{}) error
- func (c *Context) Set(key string, value interface{})
- type Driver
- type Engine
- type FlowResult
- type Printer
- type StepDetail
- type StepResult
- type StepStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalResult ¶
func MarshalResult(v interface{}) map[string]interface{}
MarshalResult converts a driver's raw result into a JSON-friendly map.
Types ¶
type AssertionResult ¶
type AssertionResult struct {
Expression string `json:"expression"`
Passed bool `json:"passed"`
Message string `json:"message,omitempty"`
Error string `json:"error,omitempty"`
Actual string `json:"actual,omitempty"` // what the expression evaluated to
}
AssertionResult captures the outcome of a single assertion.
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context holds the variable store and provides expression evaluation.
func (*Context) ResolveInterface ¶
func (c *Context) ResolveInterface(v interface{}) interface{}
ResolveInterface recursively resolves ${var} placeholders in any value.
func (*Context) ResolveString ¶
ResolveString replaces ${var} placeholders in a string with context values.
func (*Context) SaveFromResult ¶
SaveFromResult extracts values from a driver result using save mappings. Each save mapping is like: token -> response.body.token The expression is evaluated against the driver result merged into context.
type Driver ¶
type Driver interface {
Name() string
Execute(ctx context.Context, stepConfig interface{}, flowCtx *Context, env *config.EnvConfig) (map[string]interface{}, error)
}
Driver is the interface all step drivers must implement.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine orchestrates flow execution.
func (*Engine) RegisterDriver ¶
RegisterDriver adds a driver to the engine.
type FlowResult ¶
type FlowResult struct {
Name string `json:"name"`
Duration time.Duration `json:"duration"`
Steps []StepResult `json:"steps"`
Passed int `json:"passed"`
Failed int `json:"failed"`
Skipped int `json:"skipped"`
Errored int `json:"errored"`
}
FlowResult captures the outcome of an entire flow execution.
func (*FlowResult) Success ¶
func (r *FlowResult) Success() bool
Success returns true if all steps passed or were skipped.
type Printer ¶
type Printer interface {
FlowHeader(name string)
SectionHeader(name string)
StepStart(name string, driverType string, stepNum int, totalSteps int)
StepResult(result *StepResult, stepNum int, totalSteps int, verbose bool)
SetupStart(description string)
SetupResult(description string, err error)
CleanupStart(description string)
CleanupResult(description string, err error)
}
Printer is the interface for step-by-step output.
type StepDetail ¶
type StepDetail struct {
// HTTP
Method string `json:"method,omitempty"`
URL string `json:"url,omitempty"`
RequestBody string `json:"request_body,omitempty"`
StatusCode int `json:"status_code,omitempty"`
ResponseBody string `json:"response_body,omitempty"`
// DB
Query string `json:"query,omitempty"`
Params string `json:"params,omitempty"`
// Kafka
Topic string `json:"topic,omitempty"`
Action string `json:"action,omitempty"`
Match string `json:"match,omitempty"`
// Redis
RedisAction string `json:"redis_action,omitempty"`
Key string `json:"key,omitempty"`
// Shell
Command string `json:"command,omitempty"`
Stdout string `json:"stdout,omitempty"`
// Saved variables
Saved map[string]string `json:"saved,omitempty"`
}
StepDetail holds driver-specific info for verbose output.
type StepResult ¶
type StepResult struct {
Name string `json:"name"`
Status StepStatus `json:"status"`
Duration time.Duration `json:"duration"`
Driver string `json:"driver"`
Assertions []AssertionResult `json:"assertions,omitempty"`
Error string `json:"error,omitempty"`
SkipReason string `json:"skip_reason,omitempty"`
Retries int `json:"retries,omitempty"`
Detail *StepDetail `json:"detail,omitempty"` // populated in verbose mode
}
StepResult captures the outcome of a single step.
type StepStatus ¶
type StepStatus string
StepStatus represents the outcome of a step execution.
const ( StatusPassed StepStatus = "passed" StatusFailed StepStatus = "failed" StatusSkipped StepStatus = "skipped" StatusErrored StepStatus = "errored" )