Versions in this module Expand all Collapse all v0 v0.99.2 Nov 30, 2021 Changes in this version + const CFG_RESPONSE_TYPE_BIN + const CFG_RESPONSE_TYPE_HTML + const CFG_RESPONSE_TYPE_JSON + const CMD_DELIMITER + const CMD_PREFIX + const CMD_SUFFIX + const DEFAULT_PRIORITY + const ExpectedNullSuccessFmt + const FIELD_KEY_PREFIX + const JSON_INDEX_DELIM + const JSON_INDEX_END_DELIM + const JSON_INDEX_START_DELIM + const JSON_OBJECT_DELIM + const JSON_RESERVED_CHARS + const MaxResponseLines + const MaxResultMsgLength + const NumExpressionErrFmt + const VAR_PREFIX + const VAR_SUFFIX + const WS_RESPONSE + var AvailableExtensions = []Extensions + var InvalidContentType = errors.New("Invalid Content Type, falling back to binary") + func GetJsonValue(src map[string]interface{}, jsonPath string) (interface{}, error) + func JsonToYaml(i interface{}) interface + func LoadExtensions(extList []string) (ResponseParserHandler, ResponseValidatorHandler) + func PageText(input string, numLines int) string + func PromoteTokenQuotes(tokens []string) []string + func PutJsonValue(dest map[string]interface{}, jsonPath string, value interface{}) error + func SplitStringTokens(input string, delimiters string) []string + type BinaryParser struct + Fallback bool + SavePath string + func (bp *BinaryParser) Parse(response *http.Response) (map[string]interface{}, interface{}, error) + func (bp *BinaryParser) Validate(test *TestCase, result *TestResult) (bool, []*FieldMatcherResult, error) type DataStore + Store map[string]interface{} + func NewDataStore() DataStore + 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 Extensions struct + Handler ResponseParserAndValidator + ResponseType string + type FieldMatcherKey struct + Name string + RealKey JsonKey + func (f *FieldMatcherKey) GetDisplayName() string + func (f *FieldMatcherKey) GetJsonKey() string type FieldMatcherPath + func (f *FieldMatcherPath) GetDisplayPath() string + type HtmlExt struct + func (hp *HtmlExt) Parse(response *http.Response) (map[string]interface{}, interface{}, error) + func (hp *HtmlExt) Validate(test *TestCase, result *TestResult) (bool, []*FieldMatcherResult, error) + type HtmlResponseJson struct + Attributes map[string]string + Children []*HtmlResponseJson + Content string + Siblings []*HtmlResponseJson + Tag string + func (hj *HtmlResponseJson) GenericJSON() map[string]interface{} + type JSONParser struct + func (jp *JSONParser) Parse(response *http.Response) (map[string]interface{}, interface{}, error) + func (jp *JSONParser) Validate(test *TestCase, result *TestResult) (bool, []*FieldMatcherResult, error) + type JsonKey struct + IsArray bool + IsArrayElement bool + IsLast bool + IsObject bool + Name string + func GetJsonPath(keys []JsonKey, maxDepth int) (string, []JsonKey) + func SplitJsonPath(jsonPath string) []JsonKey + type KeyProcessor func(key FieldMatcherKey) interface + type MatcherProcessor func(matcher *FieldMatcherConfig, response interface{}) ResponseMatcherResults + type NodeCache struct + Cache map[string]NodeCacheObj + func (nc *NodeCache) LookUp(matcher *FieldMatcherConfig) (interface{}, []FieldMatcherKey) type ReportOptions + Micro bool type ResponseMatcher + NodeCache NodeCache + func NewResponseMatcher(ds *DataStore) ResponseMatcher + func (r *ResponseMatcher) AddMatcherConfig(config *FieldMatcherConfig) + func (r *ResponseMatcher) MatchBase(response interface{}, matcherProcessor MatcherProcessor) (bool, []*FieldMatcherResult, error) + func (r *ResponseMatcher) MatchConfig(matcher *FieldMatcherConfig, response interface{}, keyProcessor KeyProcessor) ResponseMatcherResults + type ResponseMatcherResults struct + DeferCheck bool + Err error + Results []*FieldMatcherResult + Status bool + type ResponseParser interface + Parse func(response *http.Response) (map[string]interface{}, interface{}, error) + type ResponseParserAndValidator interface + type ResponseParserHandler map[string]ResponseParser + func (rh *ResponseParserHandler) Handle(test *TestCase, response *http.Response) (map[string]interface{}, interface{}, error) + func (rh *ResponseParserHandler) LoadDefaults() + func (rh *ResponseParserHandler) Register(responseType string, handler ResponseParser) + type ResponseValidator interface + Validate func(test *TestCase, result *TestResult) (bool, []*FieldMatcherResult, error) + type ResponseValidatorHandler map[string]ResponseValidator + func (rvh *ResponseValidatorHandler) Handle(test *TestCase, result *TestResult) (bool, []*FieldMatcherResult, error) + func (rvh *ResponseValidatorHandler) LoadDefaults() + func (rvh *ResponseValidatorHandler) Register(responseType string, handler ResponseValidator) type TestCaseResponseCfg + Type string type TestResult + RawResponse interface{} type TestSuite + File string + type TokenQuoteState struct + InBacktickQuote bool + InDoubleQuote bool + InSingleQuote bool + func (ts *TokenQuoteState) InQuote() bool + func (ts *TokenQuoteState) IsQuote(char rune) bool + func (ts *TokenQuoteState) SetQuote(char rune) + func (ts *TokenQuoteState) UnsetQuote(char rune) + type TokenStack struct + Extra string + Frames []TokenStackFrame + func (s *TokenStack) Parse(input string, prefix string, suffix string) + func (s *TokenStack) Pop() *TokenStackFrame + func (s *TokenStack) Push(f TokenStackFrame) + type TokenStackFrame struct + EndPos int + Nested int + StartPos int + Token string v0.99.2-1 Dec 1, 2021 v0.99.1 Nov 16, 2021 v0.99.0 Nov 14, 2021 Changes in this version + const Any + const ArrayLengthErrFmt + const BadArrayElementFmt + const BadIndexDSFmt + const BadObjectFmt + const BadVarMatcherFmt + const CFG_RESPONSE_CODE + const CFG_SKIP + const CFG_TAGS + const DS_WS_CLIENT + const EQ + const ExpectedNullErrFmt + const GT + const GTE + const HEADER_CONTENT_TYPE + const HeadersPath + const IndexExceedsDSFmt + const LT + const LTE + const MIME_JSON + const MIME_TEXT + const MalformedDefinitionFmt + const MismatchedMatcher + const MissingDSKeyFmt + const NotEmpty + const NotEmptyErrFmt + const PatternErrFmt + const RESPONSE_PATH_FMT + const ReceivedNullErrFmt + const StatusCodePath + const TEST_EXEC_KEY_ARGS + const TEST_EXEC_KEY_BIN_PATH + const TEST_EXEC_KEY_RETURN_CODE + const TEST_KEY_EXISTS + const TEST_KEY_ITEMS + const TEST_KEY_LENGTH + const TEST_KEY_MATCHES + const TEST_KEY_PRIORITY + const TEST_KEY_PROPERTIES + const TEST_KEY_SORTED + const TEST_KEY_STORE + const TEST_KEY_TYPE + const TYPE_ARRAY + const TYPE_BOOL + const TYPE_EXEC + const TYPE_INT + const TYPE_NUM + const TYPE_OBJ + const TYPE_STR + const ValueErrFmt + const WS_ENC_BASE64 + const WS_ENC_EXTERNAL + const WS_ENC_FILE + const WS_ENC_HEX + const WS_MSG_BIN + const WS_MSG_JSON + const WS_MSG_TEXT + func Base64GzipToByteReader(input string) (io.ReadCloser, error) + func ExecuteCommand(input string) (interface{}, error) + func IndentStr(level int) string + func ObjectPrintf(message string, obj interface{}) 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 RecursiveExecuteCommand(input interface{}) (interface{}, error) + func ShouldShowReport(opts ReportOptions, test *TestResult) bool + func ToJsonObj(obj interface{}) (map[string]interface{}, error) + func YamlToJson(i interface{}) interface + type ArrayMatcher struct + DSName string + ErrorStr string + Exists bool + Items []interface{} + Length *int64 + LengthStr *string + Priority int + Sorted bool + 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 struct + Notice []string + SHA256Sum string + Saved string + Size uint64 + func (bj *BinResponseJson) GenericJSON() map[string]interface{} + type BoolMatcher struct + DSName string + ErrorStr string + Exists bool + Pattern *string + Priority int + Value *bool + 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 struct + ByteCount uint64 + func (w *ByteCountWriter) Write(b []byte) (int, error) + type Colorizer struct + Enabled bool + 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 CommandStack struct + Extra string + Frames []CommandStackFrame + func (s *CommandStack) Pop() *CommandStackFrame + func (s *CommandStack) Push(f CommandStackFrame) + type CommandStackFrame struct + CommandLine string + EndPos int + Nested int + StartPos int + func (f *CommandStackFrame) IsValid() bool + type DataStore map[string]interface + func (t *DataStore) ExpandVariable(input string) (interface{}, error) + type DepthMatchResponse struct + FoundNode DepthMatchResponseNode + NodeChain []*DepthMatchResponseNode + type DepthMatchResponseNode struct + MatchedNodeKey bool + Node interface{} + NodePath string + Status bool + type ExecutableMatcher struct + BinPath string + DSName string + ErrorStr string + Exists bool + PrgmArgs []string + Priority int + ReturnCode *int + 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 FieldMatcher interface + Error func() string + GetPriority func() int + Match func(field interface{}, datastore *DataStore) (bool, DataStore, error) + Parse func(parentNode interface{}, node map[interface{}]interface{}) error + SetError func(error string) + type FieldMatcherConfig struct + Matcher FieldMatcher + ObjectKeyPath FieldMatcherPath + type FieldMatcherPath struct + IsArrayElement bool + IsExecutable bool + Keys []FieldPathKey + Sorted bool + func (f *FieldMatcherPath) GetParentPath() string + func (f *FieldMatcherPath) GetPath() string + type FieldMatcherResult struct + Error string + IgnoreResult bool + ObjectKeyPath string + ShowExtendedMsg bool + Status bool + type FieldPathKey struct + IsArrayIndex bool + IsObjectRoot bool + Key string + type FloatMatcher struct + DSName string + ErrorStr string + Exists bool + Pattern *string + Priority int + Value *float64 + 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 InputReader struct + BodyReader io.Reader + ErrorChan chan error + FormWriter *multipart.Writer + type IntegerMatcher struct + DSName string + ErrorStr string + Exists bool + Pattern *string + Priority int + Value *int64 + 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 MultiSuiteResult struct + Error error + Passed bool + TestFile string + TestResults SuiteResult + type MultiTestSuite struct + Suites map[string]*TestSuite + Verbose bool + func NewMultiSuiteTest(testDir string, fixtures string) (*MultiTestSuite, error) + func (t *MultiTestSuite) ExecuteTests(threads int, testTags []string) (bool, []MultiSuiteResult, time.Duration, error) + func (t *MultiTestSuite) LoadTests(testDir string, fixtures string) error + type NodeCacheObj struct + Node interface{} + PathIndex int + type ObjectMatcher struct + DSName string + ErrorStr string + Exists bool + Priority int + Properties map[interface{}]interface{} + Sorted bool + 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 struct + AlwaysPrintHeaders bool + Colors Colorizer + ErrorsOnly bool + InProgress bool + Short bool + ShortErrors bool + TestsPath string + Tiny bool + type ResponseMatcher struct + Config []*FieldMatcherConfig + DS *DataStore + func (r *ResponseMatcher) Match(response interface{}) (bool, []*FieldMatcherResult, error) + func (r *ResponseMatcher) SortConfigs() + type StringMatcher struct + DSName string + ErrorStr string + Exists bool + Priority int + Value *string + 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 struct + Duration time.Duration + Failed int + Passed int + Results []*TestResult + Total int + type TestCase struct + Config TestCaseCfg + GlobalDataStore *DataStore + IsRPC bool + ResponseHeaderMatcher ResponseMatcher + ResponseMatcher ResponseMatcher + StatusCodeMatcher ResponseMatcher + Tags map[string]bool + 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) + func (t *TestCase) ValidateGeneric(response map[string]interface{}) (bool, []*FieldMatcherResult, error) + func (t *TestCase) ValidateREST(statusCode int, response map[string]interface{}, ...) (bool, []*FieldMatcherResult, error) + type TestCaseCfg struct + Description string + ExitOnRun bool + FormInput bool + Headers map[interface{}]interface{} + Input map[interface{}]interface{} + Method string + Name string + RPC TestCaseRpcCfg + Response TestCaseResponseCfg + Route string + Skip bool + Tags []string + Websocket bool + type TestCaseResponseCfg struct + FilePath string + Headers map[interface{}]interface{} + IsBinary bool + Payload map[interface{}]interface{} + StatusCode interface{} + type TestCaseRpcCfg struct + Address string + Procedure string + Protocol string + type TestResult struct + EndTime time.Time + Fields []*FieldMatcherResult + Passed bool + RequestHeaders http.Header + ResolvedRoute string + Response map[string]interface{} + ResponseHeaders map[string]interface{} + StartTime time.Time + StatusCode int + TestCase TestCase + type TestSuite struct + GlobalDataStore DataStore + Tests []*TestCase + Verbose bool + func NewTestSuite(testFile string, fixtures string) (*TestSuite, error) + 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(testFile string, fixtures string) (bool, error) + func (t *TestSuite) ReloadFile(testFile string, fixtures string) (bool, error) + type TestSuiteCfg struct + Tests []TestCaseCfg + type VarStack struct + Extra string + Frames []VarStackFrame + func (s *VarStack) Pop() *VarStackFrame + func (s *VarStack) Push(f VarStackFrame) + type VarStackFrame struct + EndPos int + Nested int + StartPos int + VarName string + func (f *VarStackFrame) IsValid() bool + type WSInput struct + Close bool + Requests []WSMessage + type WSMessage struct + Args []string + Encoding string + FilePath string + MessageType string + Payload interface{} + ReadOnly bool + Response string + WriteOnly bool + type WsResponseJson struct + Responses []map[string]interface{}