Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Expect ¶
type Expect struct { StatusCode int `json:"status_code" bson:"status_code"` Headers map[string]string `json:"headers" bson:"headers"` Evaluate []Expression `json:"evaluate" bson:"evaluate"` }
Expect response expectation
type Expression ¶
type Expression struct { Object string `json:"object" bson:"object"` Prop string `json:"prop" bson:"prop"` Operator string `json:"operator" bson:"operator"` Value string `json:"value" bson:"value"` Description string `json:"description" bson:"description"` }
Expression rule of expected response
type Pipeline ¶
type Pipeline struct { Cache bool `json:"cache" bson:"cache"` CacheAs string `json:"cache_as" bson:"cache_as"` OnFailure enum.OnFailure `json:"on_failure" bson:"on_failure"` }
Pipeline test pipeline as what to do with the response object
type Request ¶
type Request struct { URL string `json:"url" bson:"url"` Method string `json:"method" bson:"method"` Headers map[string]string `json:"headers" bson:"headers"` Payload map[string]interface{} `json:"payload" bson:"payload"` }
Request test object
type Scenario ¶
type Scenario interface { Get() ScenarioGetter Set() ScenarioSetter Run(w io.Writer) []TestResult }
Scenario is the biggest scope of a test Can have multiple test cases
type ScenarioGetter ¶
type ScenarioGetter interface { ID() string Name() string Description() string Environment() string Cases() []TestCase }
ScenarioGetter access to get scenario properties
type ScenarioSetter ¶
type ScenarioSetter interface { ID(id string) ScenarioSetter Name(name string) ScenarioSetter Description(desc string) ScenarioSetter Environment(env string) ScenarioSetter AddCase(tcase TestCase) ScenarioSetter End() Scenario }
ScenarioSetter access to set scenario properties
type TestCase ¶
type TestCase struct { Order uint `json:"order" bson:"order"` Name string `json:"name" bson:"name"` Description string `json:"description" bson:"description"` Request Request `json:"request" bson:"request"` Expect Expect `json:"expect" bson:"expect"` Pipeline Pipeline `json:"pipeline" bson:"pipeline"` }
TestCase struct
type TestResult ¶
type TestResult struct { Timestamp int64 `json:"timestamp" bson:"timestamp"` ScenarioName string `json:"scenario_name" bson:"scenario_name"` TestCaseOrder int `json:"test_case_order" bson:"test_case_order"` TestCaseName string `json:"test_case_name" bson:"test_case_name"` RequestMethod string `json:"request_method" bson:"request_method"` RequestURL string `json:"request_url" bson:"request_url"` //RequestPayload? ResponseCode int `json:"response_code" bson:"response_code"` ResponseSize int64 `json:"response_size" bson:"response_size"` //Response timing TimingDNS time.Duration `json:"timing_dns" bson:"timing_dns"` TimingHandshake time.Duration `json:"timing_handshake" bson:"timing_handshake"` TimingConnected time.Duration `json:"timing_connected" bson:"timing_connected"` TimingFirstByte time.Duration `json:"timing_first_byte" bson:"timing_first_byte"` TimingTotal time.Duration `json:"timing_total" bson:"timing_total"` //ResponsePayload? ExpectedCode int `json:"expected_code" bson:"expected_code"` Message string `json:"message" bson:"message"` }
TestResult object, all properties must be flat (not nested / denormalized) Hopefully de-normalizing the structure can make analytic easier Generally immutable, so we don't need ID and just let DB auto gen for us
func NewTestResult ¶
func NewTestResult(scn Scenario, tcn int) TestResult
NewTestResult from scenario
Source Files ¶
Click to show internal directories.
Click to hide internal directories.