Documentation ¶
Index ¶
- Constants
- Variables
- func Base64GzipToByteReader(input string) (io.ReadCloser, error)
- func ExecuteCommand(input string) (interface{}, error)
- func GetJsonValue(src map[string]interface{}, jsonPath string) (interface{}, error)
- func IndentStr(level int) string
- func JsonToYaml(i interface{}) interface{}
- func LoadExtensions(extList []string) (ResponseParserHandler, ResponseValidatorHandler)
- func ObjectPrintf(message string, obj interface{}) string
- func PageText(input string, numLines int) string
- func PrintIndentedLn(indentLevel int, format string, args ...interface{})
- func PrintReport(opts ReportOptions, passed bool, testingDuration time.Duration, ...)
- func PrintSingleTestReport(opts ReportOptions, test *TestResult)
- func PrintYamlObj(object interface{}) (string, error)
- func PromoteTokenQuotes(tokens []string) []string
- func PutJsonValue(dest map[string]interface{}, jsonPath string, value interface{}) error
- func RecursiveExecuteCommand(input interface{}) (interface{}, error)
- func ShouldShowReport(opts ReportOptions, test *TestResult) bool
- func SplitStringTokens(input string, delimiters string) []string
- func ToJsonObj(obj interface{}) (map[string]interface{}, error)
- func YamlToJson(i interface{}) interface{}
- type ArrayMatcher
- func (m *ArrayMatcher) Error() string
- func (m *ArrayMatcher) GetPriority() int
- func (m *ArrayMatcher) Match(responseValue interface{}, datastore *DataStore) (bool, DataStore, error)
- func (m *ArrayMatcher) Parse(parentNode interface{}, node map[interface{}]interface{}) error
- func (m *ArrayMatcher) SetError(error string)
- type BinResponseJson
- type BinaryParser
- type BoolMatcher
- func (m *BoolMatcher) Error() string
- func (m *BoolMatcher) GetPriority() int
- func (m *BoolMatcher) Match(responseValue interface{}, datastore *DataStore) (bool, DataStore, error)
- func (m *BoolMatcher) Parse(parentNode interface{}, node map[interface{}]interface{}) error
- func (m *BoolMatcher) SetError(error string)
- type ByteCountWriter
- type Colorizer
- func (c *Colorizer) BrightBlue(input string) string
- func (c *Colorizer) BrightCyan(input string) string
- func (c *Colorizer) BrightGrey(input string) string
- func (c *Colorizer) BrightRed(input string) string
- func (c *Colorizer) BrightWhite(input string) string
- func (c *Colorizer) BrightYellow(input string) string
- func (c *Colorizer) Cyan(input string) string
- func (c *Colorizer) Green(input string) string
- func (c *Colorizer) Red(input string) string
- func (c *Colorizer) Underline(input string) string
- func (c *Colorizer) Yellow(input string) string
- type DataStore
- func (t *DataStore) ExpandVariable(input string) (interface{}, error)
- func (t *DataStore) Get(key string) interface{}
- func (t *DataStore) Put(key string, value interface{})
- func (t *DataStore) PutVariable(variable string, value interface{}) error
- func (t *DataStore) RecursiveResolveVariables(input interface{}) (interface{}, error)
- type DepthMatchResponse
- type DepthMatchResponseNode
- type ExecutableMatcher
- func (m *ExecutableMatcher) Error() string
- func (m *ExecutableMatcher) GetPriority() int
- func (m *ExecutableMatcher) Match(responseValue interface{}, datastore *DataStore) (bool, DataStore, error)
- func (m *ExecutableMatcher) Parse(parentNode interface{}, node map[interface{}]interface{}) error
- func (m *ExecutableMatcher) SetError(error string)
- type Extensions
- type FieldMatcher
- type FieldMatcherConfig
- type FieldMatcherKey
- type FieldMatcherPath
- type FieldMatcherResult
- type FloatMatcher
- func (m *FloatMatcher) Error() string
- func (m *FloatMatcher) GetPriority() int
- func (m *FloatMatcher) Match(responseValue interface{}, datastore *DataStore) (bool, DataStore, error)
- func (m *FloatMatcher) Parse(parentNode interface{}, node map[interface{}]interface{}) error
- func (m *FloatMatcher) SetError(error string)
- type HtmlExt
- type HtmlResponseJson
- type InputReader
- type IntegerMatcher
- func (m *IntegerMatcher) Error() string
- func (m *IntegerMatcher) GetPriority() int
- func (m *IntegerMatcher) Match(responseValue interface{}, datastore *DataStore) (bool, DataStore, error)
- func (m *IntegerMatcher) Parse(parentNode interface{}, node map[interface{}]interface{}) error
- func (m *IntegerMatcher) SetError(error string)
- type JSONParser
- type JsonKey
- type KeyProcessor
- type MatcherProcessor
- type MultiSuiteResult
- type MultiTestSuite
- type NodeCache
- type NodeCacheObj
- type ObjectMatcher
- func (m *ObjectMatcher) Error() string
- func (m *ObjectMatcher) GetPriority() int
- func (m *ObjectMatcher) Match(responseValue interface{}, datastore *DataStore) (bool, DataStore, error)
- func (m *ObjectMatcher) Parse(parentNode interface{}, node map[interface{}]interface{}) error
- func (m *ObjectMatcher) SetError(error string)
- type ReportOptions
- type ResponseMatcher
- func (r *ResponseMatcher) AddMatcherConfig(config *FieldMatcherConfig)
- func (r *ResponseMatcher) Match(response interface{}) (bool, []*FieldMatcherResult, error)
- func (r *ResponseMatcher) MatchBase(response interface{}, matcherProcessor MatcherProcessor) (bool, []*FieldMatcherResult, error)
- func (r *ResponseMatcher) MatchConfig(matcher *FieldMatcherConfig, response interface{}, keyProcessor KeyProcessor) ResponseMatcherResults
- func (r *ResponseMatcher) SortConfigs()
- type ResponseMatcherResults
- type ResponseParser
- type ResponseParserAndValidator
- type ResponseParserHandler
- type ResponseValidator
- type ResponseValidatorHandler
- type StringMatcher
- func (m *StringMatcher) Error() string
- func (m *StringMatcher) GetPriority() int
- func (m *StringMatcher) Match(responseValue interface{}, datastore *DataStore) (bool, DataStore, error)
- func (m *StringMatcher) Parse(parentNode interface{}, node map[interface{}]interface{}) error
- func (m *StringMatcher) SetError(error string)
- type SuiteResult
- type TestCase
- func (t *TestCase) CloseWebsocket()
- func (t *TestCase) Execute(testTags []string) (passed bool, result *TestResult, err error)
- func (t *TestCase) GetResolvedTestInput() (interface{}, error)
- func (t *TestCase) GetRestInput(input interface{}) (*InputReader, error)
- func (t *TestCase) GetTestHeaders(inputReader *InputReader) (map[interface{}]interface{}, error)
- func (t *TestCase) GetTestRoute() (string, error)
- func (t *TestCase) GetTestRpcAddr() (string, error)
- func (t *TestCase) GetWebsocketClient() (*websocket.Conn, string, error)
- func (t *TestCase) GetWebsocketInput(input interface{}) (*WSInput, error)
- func (t *TestCase) HasTag(tagList string) bool
- func (t *TestCase) LoadConfig(test *TestCaseCfg) error
- func (t *TestCase) SkipTestOnTags(testTags []string) bool
- func (t *TestCase) StepExecWebsocket(step int, result *TestResult) (passed bool, remaining int, err error)
- type TestCaseCfg
- type TestCaseResponseCfg
- type TestCaseRpcCfg
- type TestResult
- type TestSuite
- func (t *TestSuite) Close()
- func (t *TestSuite) ExecuteTests(testTags []string) (bool, SuiteResult, error)
- func (t *TestSuite) InitializeDataStore(fixtures string) error
- func (t *TestSuite) LoadFixtures(fixtures string) (map[string]interface{}, error)
- func (t *TestSuite) LoadTests(fixtures string) (bool, error)
- func (t *TestSuite) ReloadFile(fixtures string) (bool, error)
- type TestSuiteCfg
- type TokenQuoteState
- type TokenStack
- type TokenStackFrame
- type WSInput
- type WSMessage
- type WsResponseJson
Constants ¶
const ( VAR_PREFIX = "@{" VAR_SUFFIX = "}" )
const ( Any = "$any" NotEmpty = "$notEmpty" LT = "$<" LTE = "$<=" GT = "$>" GTE = "$>=" EQ = "$=" FIELD_KEY_PREFIX = "$." // special keywords used in validation object definitions TEST_KEY_TYPE = "type" TEST_KEY_PROPERTIES = "properties" TEST_KEY_LENGTH = "length" TEST_KEY_ITEMS = "items" TEST_KEY_SORTED = "sorted" TEST_KEY_STORE = "storeAs" TEST_KEY_PRIORITY = "priority" TEST_KEY_MATCHES = "matches" TEST_KEY_EXISTS = "exists" TEST_EXEC_KEY_RETURN_CODE = "returns" TEST_EXEC_KEY_BIN_PATH = "bin" TEST_EXEC_KEY_ARGS = "args" ValueErrFmt = "Expected value '%v' did not match the actual value '%v'" PatternErrFmt = "Failed to match actual value '%v' with expected pattern: '%v'" NotEmptyErrFmt = "Expected non-empty value, but got value '%v' instead." ArrayLengthErrFmt = "Expected array with length %v %v but found length %v instead." ReceivedNullErrFmt = "Received null value when non-null value was expected" ExpectedNullErrFmt = "Expected null value when non-null value was returned" ExpectedNullSuccessFmt = "[Expected] %v" MalformedDefinitionFmt = "\nMalformed '%v' field detected on %v" MismatchedMatcher = "Test expected a value type matching '%v' but response field is of type '%v'." BadVarMatcherFmt = "Failed to resolve variable within matcher: %v" NumExpressionErrFmt = "Expected a result evaluating to: %v %v but got %v instead" BadArrayElementFmt = "\nExpected elements on '%v' to be objects" BadObjectFmt = "\nExpected property '%v' to map to an object" // available field matchers TYPE_INT = "integer" TYPE_NUM = "number" TYPE_STR = "string" TYPE_ARRAY = "array" TYPE_OBJ = "object" TYPE_BOOL = "bool" TYPE_EXEC = "external" DEFAULT_PRIORITY = 9999 )
const ( JSON_OBJECT_DELIM = "." JSON_INDEX_START_DELIM = "[" JSON_INDEX_END_DELIM = "]" JSON_INDEX_DELIM = JSON_INDEX_START_DELIM + JSON_INDEX_END_DELIM JSON_RESERVED_CHARS = JSON_OBJECT_DELIM + JSON_INDEX_DELIM )
const ( MaxResultMsgLength = 92 MaxResponseLines = 80 )
const ( CMD_PREFIX = "$(" CMD_SUFFIX = ")" CMD_DELIMITER = " " )
const ( MissingDSKeyFmt = "Attempted to retrieve data from data store that does not exist: key: %v" BadIndexDSFmt = "Attempted to index into a data store value with a non-positive or non-integer value: %v" IndexExceedsDSFmt = "Index for data store value exceeds its max length: %v" StatusCodePath = "response.StatusCode" HeadersPath = "response.Header" )
const ( // Test Config keys CFG_SKIP = "skip" CFG_TAGS = "tags" CFG_RESPONSE_CODE = "code" CFG_RESPONSE_TYPE_BIN = "binary" CFG_RESPONSE_TYPE_JSON = "json" CFG_RESPONSE_TYPE_HTML = "html" // Mime types MIME_JSON = "application/json" MIME_TEXT = "text/plain" //Headers HEADER_CONTENT_TYPE = "Content-Type" // MISC RESPONSE_PATH_FMT = "binary-response-*" //DataStore Vars DS_WS_CLIENT = "ws" )
const ( WS_ENC_BASE64 = "base64gzip" WS_ENC_HEX = "hex" WS_ENC_FILE = "file" WS_ENC_EXTERNAL = "external" WS_RESPONSE = "responses" WS_MSG_TEXT = "text" WS_MSG_JSON = "json" WS_MSG_BIN = "binary" )
Variables ¶
var ( // Configure what extensions are available to use here. AvailableExtensions = []Extensions{ { ResponseType: "html", Handler: &HtmlExt{}, }, } )
var (
InvalidContentType = errors.New("Invalid Content Type, falling back to binary")
)
Functions ¶
func Base64GzipToByteReader ¶
func Base64GzipToByteReader(input string) (io.ReadCloser, error)
func ExecuteCommand ¶
func GetJsonValue ¶ added in v0.99.2
func JsonToYaml ¶ added in v0.99.2
func JsonToYaml(i interface{}) interface{}
func LoadExtensions ¶ added in v0.99.2
func LoadExtensions(extList []string) (ResponseParserHandler, ResponseValidatorHandler)
func ObjectPrintf ¶
func PageText ¶ added in v0.99.2
PageText will show the first numLines of text in a string and dump the entire input string to a temporary file for later review.
func PrintIndentedLn ¶
func PrintReport ¶
func PrintReport(opts ReportOptions, passed bool, testingDuration time.Duration, results []MultiSuiteResult)
func PrintSingleTestReport ¶
func PrintSingleTestReport(opts ReportOptions, test *TestResult)
func PrintYamlObj ¶
func PromoteTokenQuotes ¶ added in v0.99.2
PromoteTokenQuotes will 'promote' nested quotes up one level such that the outermost wrapped quotes will be removed, and all the nested escaped quotes will have their corresponding escape characters removed one nested level.
func PutJsonValue ¶ added in v0.99.2
PutJsonValue Insert an arbitrary value at a desired jsonPath. If the intermediary objects/arrays don't exist, they will be created.
func RecursiveExecuteCommand ¶
func RecursiveExecuteCommand(input interface{}) (interface{}, error)
Iterate through an object and execute any command strings that are located. Returns the input object with the command strings expanded to their results
func ShouldShowReport ¶
func ShouldShowReport(opts ReportOptions, test *TestResult) bool
func SplitStringTokens ¶ added in v0.99.2
SplitStringTokens will split an input on any one of the delimiters. However, it will ignore delimiters that are within quotes (single, double, or backticks) or delimiters that are escaped with a preceding backslash '\'.
func YamlToJson ¶
func YamlToJson(i interface{}) interface{}
Types ¶
type ArrayMatcher ¶
type ArrayMatcher struct { Length *int64 LengthStr *string Items []interface{} ErrorStr string Exists bool DSName string Sorted bool Priority int }
func (*ArrayMatcher) Error ¶
func (m *ArrayMatcher) Error() string
func (*ArrayMatcher) GetPriority ¶
func (m *ArrayMatcher) GetPriority() int
func (*ArrayMatcher) Match ¶
func (m *ArrayMatcher) Match(responseValue interface{}, datastore *DataStore) (bool, DataStore, error)
func (*ArrayMatcher) Parse ¶
func (m *ArrayMatcher) Parse(parentNode interface{}, node map[interface{}]interface{}) error
func (*ArrayMatcher) SetError ¶
func (m *ArrayMatcher) SetError(error string)
type BinResponseJson ¶
type BinResponseJson struct { Saved string `json:"saved"` Notice []string `json:"NOTICE,omitempty"` Size uint64 `json:"size"` SHA256Sum string `json:"sha256sum"` }
func (*BinResponseJson) GenericJSON ¶
func (bj *BinResponseJson) GenericJSON() map[string]interface{}
type BinaryParser ¶ added in v0.99.2
Default built-in handler and validator for responses containing binary data.
func (*BinaryParser) Parse ¶ added in v0.99.2
func (bp *BinaryParser) Parse(response *http.Response) (map[string]interface{}, interface{}, error)
Implement ResponseHandler
func (*BinaryParser) Validate ¶ added in v0.99.2
func (bp *BinaryParser) Validate(test *TestCase, result *TestResult) (bool, []*FieldMatcherResult, error)
Implement ResponseValidator
type BoolMatcher ¶
type BoolMatcher struct { Value *bool Pattern *string ErrorStr string Exists bool DSName string Priority int }
func (*BoolMatcher) Error ¶
func (m *BoolMatcher) Error() string
func (*BoolMatcher) GetPriority ¶
func (m *BoolMatcher) GetPriority() int
func (*BoolMatcher) Match ¶
func (m *BoolMatcher) Match(responseValue interface{}, datastore *DataStore) (bool, DataStore, error)
func (*BoolMatcher) Parse ¶
func (m *BoolMatcher) Parse(parentNode interface{}, node map[interface{}]interface{}) error
func (*BoolMatcher) SetError ¶
func (m *BoolMatcher) SetError(error string)
type ByteCountWriter ¶
type ByteCountWriter struct {
ByteCount uint64
}
type Colorizer ¶
type Colorizer struct {
Enabled bool
}
func (*Colorizer) BrightBlue ¶
func (*Colorizer) BrightCyan ¶
func (*Colorizer) BrightGrey ¶
func (*Colorizer) BrightWhite ¶
func (*Colorizer) BrightYellow ¶
type DataStore ¶
type DataStore struct {
Store map[string]interface{}
}
func NewDataStore ¶ added in v0.99.2
func NewDataStore() DataStore
func (*DataStore) ExpandVariable ¶
func (*DataStore) PutVariable ¶ added in v0.99.2
PutVariable Given a variable name (or path in a JSON object) store the value for said path.
func (*DataStore) RecursiveResolveVariables ¶ added in v0.99.2
type DepthMatchResponse ¶
type DepthMatchResponse struct { FoundNode DepthMatchResponseNode NodeChain []*DepthMatchResponseNode }
type DepthMatchResponseNode ¶
type ExecutableMatcher ¶
type ExecutableMatcher struct { ReturnCode *int BinPath string PrgmArgs []string ErrorStr string Exists bool DSName string Priority int }
func (*ExecutableMatcher) Error ¶
func (m *ExecutableMatcher) Error() string
func (*ExecutableMatcher) GetPriority ¶
func (m *ExecutableMatcher) GetPriority() int
func (*ExecutableMatcher) Match ¶
func (m *ExecutableMatcher) Match(responseValue interface{}, datastore *DataStore) (bool, DataStore, error)
func (*ExecutableMatcher) Parse ¶
func (m *ExecutableMatcher) Parse(parentNode interface{}, node map[interface{}]interface{}) error
func (*ExecutableMatcher) SetError ¶
func (m *ExecutableMatcher) SetError(error string)
type Extensions ¶ added in v0.99.2
type Extensions struct { ResponseType string Handler ResponseParserAndValidator }
type FieldMatcher ¶
type FieldMatcherConfig ¶
type FieldMatcherConfig struct { Matcher FieldMatcher ObjectKeyPath FieldMatcherPath }
type FieldMatcherKey ¶ added in v0.99.2
func (*FieldMatcherKey) GetDisplayName ¶ added in v0.99.2
func (f *FieldMatcherKey) GetDisplayName() string
func (*FieldMatcherKey) GetJsonKey ¶ added in v0.99.2
func (f *FieldMatcherKey) GetJsonKey() string
type FieldMatcherPath ¶
type FieldMatcherPath struct { Keys []FieldMatcherKey Sorted bool IsExecutable bool }
func (*FieldMatcherPath) GetDisplayPath ¶ added in v0.99.2
func (f *FieldMatcherPath) GetDisplayPath() string
func (*FieldMatcherPath) GetPath ¶
func (f *FieldMatcherPath) GetPath() string
type FieldMatcherResult ¶
type FloatMatcher ¶
type FloatMatcher struct { Value *float64 Pattern *string Exists bool ErrorStr string DSName string Priority int }
func (*FloatMatcher) Error ¶
func (m *FloatMatcher) Error() string
func (*FloatMatcher) GetPriority ¶
func (m *FloatMatcher) GetPriority() int
func (*FloatMatcher) Match ¶
func (m *FloatMatcher) Match(responseValue interface{}, datastore *DataStore) (bool, DataStore, error)
func (*FloatMatcher) Parse ¶
func (m *FloatMatcher) Parse(parentNode interface{}, node map[interface{}]interface{}) error
func (*FloatMatcher) SetError ¶
func (m *FloatMatcher) SetError(error string)
type HtmlExt ¶ added in v0.99.2
type HtmlExt struct{}
func (*HtmlExt) Validate ¶ added in v0.99.2
func (hp *HtmlExt) Validate(test *TestCase, result *TestResult) (bool, []*FieldMatcherResult, error)
Implement ResponseValidator
type HtmlResponseJson ¶ added in v0.99.2
type HtmlResponseJson struct { Tag string `json:"tag"` Content string `json:"content"` Attributes map[string]string `json:"attributes"` Children []*HtmlResponseJson `json:"children"` Siblings []*HtmlResponseJson `json:"siblings"` }
func (*HtmlResponseJson) GenericJSON ¶ added in v0.99.2
func (hj *HtmlResponseJson) GenericJSON() map[string]interface{}
type InputReader ¶
type IntegerMatcher ¶
type IntegerMatcher struct { Value *int64 Pattern *string Exists bool ErrorStr string DSName string Priority int }
func (*IntegerMatcher) Error ¶
func (m *IntegerMatcher) Error() string
func (*IntegerMatcher) GetPriority ¶
func (m *IntegerMatcher) GetPriority() int
func (*IntegerMatcher) Match ¶
func (m *IntegerMatcher) Match(responseValue interface{}, datastore *DataStore) (bool, DataStore, error)
func (*IntegerMatcher) Parse ¶
func (m *IntegerMatcher) Parse(parentNode interface{}, node map[interface{}]interface{}) error
func (*IntegerMatcher) SetError ¶
func (m *IntegerMatcher) SetError(error string)
type JSONParser ¶ added in v0.99.2
type JSONParser struct{}
Default built-in response handler and validator for JSON rest APIs
func (*JSONParser) Parse ¶ added in v0.99.2
func (jp *JSONParser) Parse(response *http.Response) (map[string]interface{}, interface{}, error)
Implement ResponseHandler
func (*JSONParser) Validate ¶ added in v0.99.2
func (jp *JSONParser) Validate(test *TestCase, result *TestResult) (bool, []*FieldMatcherResult, error)
Implement ResponseValidator
type JsonKey ¶ added in v0.99.2
func GetJsonPath ¶ added in v0.99.2
GetJsonPath Returns a string representation of a series of json keys that make up a path to a value in a json object. The maxDepth provides a limit on how deep into the path structure to construct since the key object count to json path node count is not always 1-1 (e.g. array[index] is split as 2 keys but only counts as a single node in the path) The remaining unprocessed keys are returned along with the string representation of the processed keys.
func SplitJsonPath ¶ added in v0.99.2
SplitJsonPath Splits a string formatted as a JSON accessor into its individual keys with metadata. E.g. "data.someArray[1].value" -> "[data, someArray, 1, value]"
type KeyProcessor ¶ added in v0.99.2
type KeyProcessor func(key FieldMatcherKey) interface{}
Given an input key, return a JSON node representing the key contents
type MatcherProcessor ¶ added in v0.99.2
type MatcherProcessor func(matcher *FieldMatcherConfig, response interface{}) ResponseMatcherResults
type MultiSuiteResult ¶
type MultiSuiteResult struct { Passed bool Error error TestResults SuiteResult TestFile string }
type MultiTestSuite ¶
func NewMultiSuiteTest ¶
func NewMultiSuiteTest(testDir string, fixtures string) (*MultiTestSuite, error)
func (*MultiTestSuite) ExecuteTests ¶
func (t *MultiTestSuite) ExecuteTests(threads int, testTags []string) (bool, []MultiSuiteResult, time.Duration, error)
type NodeCache ¶ added in v0.99.2
type NodeCache struct {
Cache map[string]NodeCacheObj
}
func (*NodeCache) LookUp ¶ added in v0.99.2
func (nc *NodeCache) LookUp(matcher *FieldMatcherConfig) (interface{}, []FieldMatcherKey)
type NodeCacheObj ¶
type NodeCacheObj struct {
Node interface{}
}
type ObjectMatcher ¶
type ObjectMatcher struct { Properties map[interface{}]interface{} ErrorStr string Exists bool DSName string Sorted bool Priority int }
func (*ObjectMatcher) Error ¶
func (m *ObjectMatcher) Error() string
func (*ObjectMatcher) GetPriority ¶
func (m *ObjectMatcher) GetPriority() int
func (*ObjectMatcher) Match ¶
func (m *ObjectMatcher) Match(responseValue interface{}, datastore *DataStore) (bool, DataStore, error)
func (*ObjectMatcher) Parse ¶
func (m *ObjectMatcher) Parse(parentNode interface{}, node map[interface{}]interface{}) error
func (*ObjectMatcher) SetError ¶
func (m *ObjectMatcher) SetError(error string)
type ReportOptions ¶
type ResponseMatcher ¶
type ResponseMatcher struct { DS *DataStore Config []*FieldMatcherConfig NodeCache NodeCache }
func NewResponseMatcher ¶ added in v0.99.2
func NewResponseMatcher(ds *DataStore) ResponseMatcher
func (*ResponseMatcher) AddMatcherConfig ¶ added in v0.99.2
func (r *ResponseMatcher) AddMatcherConfig(config *FieldMatcherConfig)
func (*ResponseMatcher) Match ¶
func (r *ResponseMatcher) Match(response interface{}) (bool, []*FieldMatcherResult, error)
Match Validates our test pattern against the actual JSON response
func (*ResponseMatcher) MatchBase ¶ added in v0.99.2
func (r *ResponseMatcher) MatchBase(response interface{}, matcherProcessor MatcherProcessor) (bool, []*FieldMatcherResult, error)
func (*ResponseMatcher) MatchConfig ¶ added in v0.99.2
func (r *ResponseMatcher) MatchConfig(matcher *FieldMatcherConfig, response interface{}, keyProcessor KeyProcessor) ResponseMatcherResults
func (*ResponseMatcher) SortConfigs ¶
func (r *ResponseMatcher) SortConfigs()
type ResponseMatcherResults ¶ added in v0.99.2
type ResponseMatcherResults struct { Status bool Results []*FieldMatcherResult DeferCheck bool Err error }
type ResponseParser ¶ added in v0.99.2
type ResponseParserAndValidator ¶ added in v0.99.2
type ResponseParserAndValidator interface { ResponseValidator ResponseParser }
type ResponseParserHandler ¶ added in v0.99.2
type ResponseParserHandler map[string]ResponseParser
func (*ResponseParserHandler) LoadDefaults ¶ added in v0.99.2
func (rh *ResponseParserHandler) LoadDefaults()
func (*ResponseParserHandler) Register ¶ added in v0.99.2
func (rh *ResponseParserHandler) Register(responseType string, handler ResponseParser)
type ResponseValidator ¶ added in v0.99.2
type ResponseValidator interface {
Validate(test *TestCase, result *TestResult) (bool, []*FieldMatcherResult, error)
}
type ResponseValidatorHandler ¶ added in v0.99.2
type ResponseValidatorHandler map[string]ResponseValidator
func (*ResponseValidatorHandler) Handle ¶ added in v0.99.2
func (rvh *ResponseValidatorHandler) Handle(test *TestCase, result *TestResult) (bool, []*FieldMatcherResult, error)
func (*ResponseValidatorHandler) LoadDefaults ¶ added in v0.99.2
func (rvh *ResponseValidatorHandler) LoadDefaults()
func (*ResponseValidatorHandler) Register ¶ added in v0.99.2
func (rvh *ResponseValidatorHandler) Register(responseType string, handler ResponseValidator)
type StringMatcher ¶
func (*StringMatcher) Error ¶
func (m *StringMatcher) Error() string
func (*StringMatcher) GetPriority ¶
func (m *StringMatcher) GetPriority() int
func (*StringMatcher) Match ¶
func (m *StringMatcher) Match(responseValue interface{}, datastore *DataStore) (bool, DataStore, error)
func (*StringMatcher) Parse ¶
func (m *StringMatcher) Parse(parentNode interface{}, node map[interface{}]interface{}) error
func (*StringMatcher) SetError ¶
func (m *StringMatcher) SetError(error string)
type SuiteResult ¶
type TestCase ¶
type TestCase struct { Config TestCaseCfg IsRPC bool ResponseHeaderMatcher ResponseMatcher StatusCodeMatcher ResponseMatcher ResponseMatcher ResponseMatcher GlobalDataStore *DataStore Tags map[string]bool }
func (*TestCase) CloseWebsocket ¶
func (t *TestCase) CloseWebsocket()
func (*TestCase) Execute ¶
func (t *TestCase) Execute(testTags []string) (passed bool, result *TestResult, err error)
func (*TestCase) GetResolvedTestInput ¶
Returns a new input object with all included variables resolved
func (*TestCase) GetRestInput ¶
func (t *TestCase) GetRestInput(input interface{}) (*InputReader, error)
func (*TestCase) GetTestHeaders ¶
func (t *TestCase) GetTestHeaders(inputReader *InputReader) (map[interface{}]interface{}, error)
func (*TestCase) GetTestRoute ¶
func (*TestCase) GetTestRpcAddr ¶
func (*TestCase) GetWebsocketClient ¶
func (*TestCase) GetWebsocketInput ¶
func (*TestCase) HasTag ¶
tag string can contain 1 or more tags separated by ",". This syntax will OR the tags.
func (*TestCase) LoadConfig ¶
func (t *TestCase) LoadConfig(test *TestCaseCfg) error
func (*TestCase) SkipTestOnTags ¶
func (*TestCase) StepExecWebsocket ¶
type TestCaseCfg ¶
type TestCaseCfg struct { Name string `yaml:"name"` Description string `yaml:"description"` ExitOnRun bool `yaml:"exit"` Skip bool `yaml:"skip"` Input map[interface{}]interface{} `yaml:"input"` FormInput bool `yaml:"formInput"` Tags []string `yaml:"tags"` Headers map[interface{}]interface{} `yaml:"headers"` Route string `yaml:"route"` Method string `yaml:"method"` RPC TestCaseRpcCfg `yaml:"rpc"` Websocket bool `yaml:"websocket"` Response TestCaseResponseCfg `yaml:"response"` }
type TestCaseResponseCfg ¶
type TestCaseResponseCfg struct { // status code could end up being either a number or an object defining a validation definition StatusCode interface{} `yaml:"code"` Type string `yaml:"type"` FilePath string `yaml:"filePath"` Payload map[interface{}]interface{} `yaml:"payload"` Headers map[interface{}]interface{} `yaml:"headers"` }
type TestCaseRpcCfg ¶
type TestResult ¶
type TestSuite ¶
func (*TestSuite) ExecuteTests ¶
func (t *TestSuite) ExecuteTests(testTags []string) (bool, SuiteResult, error)
func (*TestSuite) InitializeDataStore ¶
func (*TestSuite) LoadFixtures ¶
type TestSuiteCfg ¶
type TestSuiteCfg struct {
Tests []TestCaseCfg `yaml:"tests"`
}
type TokenQuoteState ¶ added in v0.99.2
func (*TokenQuoteState) InQuote ¶ added in v0.99.2
func (ts *TokenQuoteState) InQuote() bool
func (*TokenQuoteState) IsQuote ¶ added in v0.99.2
func (ts *TokenQuoteState) IsQuote(char rune) bool
func (*TokenQuoteState) SetQuote ¶ added in v0.99.2
func (ts *TokenQuoteState) SetQuote(char rune)
func (*TokenQuoteState) UnsetQuote ¶ added in v0.99.2
func (ts *TokenQuoteState) UnsetQuote(char rune)
type TokenStack ¶ added in v0.99.2
type TokenStack struct { Frames []TokenStackFrame Extra string }
func (*TokenStack) Parse ¶ added in v0.99.2
func (s *TokenStack) Parse(input string, prefix string, suffix string)
Parse Extracts tokens that are wrapped between a predetermined prefix and suffix tokens are stored in the order from the inner-most nested out
func (*TokenStack) Pop ¶ added in v0.99.2
func (s *TokenStack) Pop() *TokenStackFrame
func (*TokenStack) Push ¶ added in v0.99.2
func (s *TokenStack) Push(f TokenStackFrame)
type TokenStackFrame ¶ added in v0.99.2
type WSMessage ¶
type WSMessage struct { Payload interface{} `yaml:"payload" json:"payload"` Args []string `yaml:"args" json:"args"` WriteOnly bool `yaml:"WriteOnly" json:"WriteOnly"` ReadOnly bool `yaml:"readOnly" json:"readOnly"` Response string `yaml:"response" json:"response"` MessageType string `yam:"type" json:"type"` Encoding string `yaml:"encoding" json:"encoding"` FilePath string `yaml:"filePath" json:"filePath"` }
type WsResponseJson ¶
type WsResponseJson struct {
Responses []map[string]interface{} `json:"responses"`
}