Documentation ¶
Overview ¶
Test helps to create integration tester in a easy way
you just need to define the tester structure and run it.
example at https://github.com/joaosoft/tester/tree/master/example
Index ¶
- func Exists(file string) bool
- func GetEnv() string
- func ReadFile(fileName string, obj interface{}) ([]byte, error)
- func ReadFileLines(fileName string) ([]string, error)
- func WriteFile(fileName string, obj interface{}) error
- type AppConfig
- type BaseTest
- type BodyMatch
- type HttpBody
- type HttpCookies
- type HttpHeaders
- type HttpRunner
- type HttpTest
- type IMatcher
- type IRunner
- type ISystem
- type Matcher
- type NSQRunner
- type NsqCommand
- type NsqConfig
- type NsqTest
- type RedisCommand
- type RedisConfig
- type RedisRunner
- type RedisTest
- type Runner
- func (runner *Runner) NewNSQRunner(scenarioRunner *ScenarioRunner, services []NsqTest) *NSQRunner
- func (runner *Runner) NewRedisRunner(scenarioRunner *ScenarioRunner, services []RedisTest) *RedisRunner
- func (runner *Runner) NewSQLRunner(scenarioRunner *ScenarioRunner, services []SqlTest) *SQLRunner
- func (runner *Runner) NewScenarioRunner(scenario *Scenario) (*ScenarioRunner, error)
- func (runner *Runner) NewWebRunner(scenarioRunner *ScenarioRunner, tests []HttpTest) *HttpRunner
- func (runner *Runner) Run() error
- type SQLRunner
- type Scenario
- type ScenarioRunner
- type SqlCommand
- type SqlConfig
- type SqlTest
- type TestFile
- type Tester
- type TesterConfig
- type TesterOption
- type Tests
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadFileLines ¶
Types ¶
type BodyMatch ¶
type BodyMatch struct { Match int `json:"matcher"` Value interface{} `json:"value"` }
BodyMatch ...
type HttpCookies ¶
type HttpCookies struct { Name *string `json:"name"` Value *string `json:"value"` Path *string `json:"path"` // optional Domain *string `json:"domain"` // optional Expires *time.Time `json:"expires"` // optional }
HttpCookies ...
type HttpRunner ¶
type HttpRunner struct {
// contains filtered or unexported fields
}
func (*HttpRunner) Run ¶
func (runner *HttpRunner) Run() error
type HttpTest ¶
type HttpTest struct { BaseTest Scenario Scenario `json:"scenario"` Host string `json:"host"` Method string `json:"method"` Route string `json:"route"` Headers *HttpHeaders `json:"headers"` Cookies []*HttpCookies `json:"cookies"` Body *json.RawMessage `json:"body"` File *string `json:"file"` Expected struct { Status int `json:"status"` Body HttpBody `json:"body"` } `json:"expected"` }
HttpTest ...
type IMatcher ¶
type IMatcher interface {
Match(obtained interface{}) error
}
func NewMatcher ¶
func NewMatcher(expected interface{}) IMatcher
type NsqCommand ¶
type NsqConfig ¶
type NsqConfig struct { Lookupd string `json:"lookupd"` RequeueDelay int64 `json:"requeue_delay"` MaxInFlight int `json:"max_in_flight"` MaxAttempts uint16 `json:"max_attempts"` }
NsqConfig ...
type NsqTest ¶
type NsqTest struct { BaseTest Scenario Scenario `json:"scenario"` Configuration *NsqConfig `json:"configuration"` Expected NsqCommand `json"expected"` }
NsqTest ...
type RedisCommand ¶
type RedisConfig ¶
type RedisConfig struct { Address string `json:"address"` Password string `json:"password"` Database int `json:"database"` }
RedisConfig ...
type RedisRunner ¶
type RedisRunner struct {
// contains filtered or unexported fields
}
func (*RedisRunner) Run ¶
func (runner *RedisRunner) Run() error
type RedisTest ¶
type RedisTest struct { BaseTest Scenario Scenario `json:"scenario"` Configuration *RedisConfig `json:"configuration"` Connection *string `json:"connection"` Expected RedisCommand `json"expected"` }
RedisTest ...
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
func (*Runner) NewNSQRunner ¶
func (runner *Runner) NewNSQRunner(scenarioRunner *ScenarioRunner, services []NsqTest) *NSQRunner
func (*Runner) NewRedisRunner ¶
func (runner *Runner) NewRedisRunner(scenarioRunner *ScenarioRunner, services []RedisTest) *RedisRunner
func (*Runner) NewSQLRunner ¶
func (runner *Runner) NewSQLRunner(scenarioRunner *ScenarioRunner, services []SqlTest) *SQLRunner
func (*Runner) NewScenarioRunner ¶
func (runner *Runner) NewScenarioRunner(scenario *Scenario) (*ScenarioRunner, error)
NewScenarioRunner ...
func (*Runner) NewWebRunner ¶
func (runner *Runner) NewWebRunner(scenarioRunner *ScenarioRunner, tests []HttpTest) *HttpRunner
type Scenario ¶
type Scenario struct { Options map[string]string `json:"options,omitempty"` Files []string `json:"files,omitempty"` Setup []*setup.Services `json:"setup,omitempty"` Http []HttpTest `json:"http"` }
Scenario ...
type ScenarioRunner ¶
type ScenarioRunner struct {
// contains filtered or unexported fields
}
ScenarioRunner ...
type SqlCommand ¶
SqlCommand ...
type SqlTest ¶
type SqlTest struct { BaseTest Scenario Scenario `json:"scenario"` Configuration *SqlConfig `json:"configuration"` Connection *string `json:"connection"` Expected SqlCommand `json"expected"` }
SqlTest ...
type Tester ¶
type Tester struct {
// contains filtered or unexported fields
}
Test ...
func (*Tester) Reconfigure ¶
func (tester *Tester) Reconfigure(options ...TesterOption)
Reconfigure ...
type TesterConfig ¶
type TesterConfig struct { Log struct { Level string `json:"level"` } `json:"log"` }
TesterConfig ...
Source Files ¶
Click to show internal directories.
Click to hide internal directories.