Documentation
¶
Index ¶
Constants ¶
View Source
const ( SkippedString = "\033[1;33mSKIPPED (%s)\033[0m" PassedString = "\033[1;32mPASSED (%s)\033[0m" FailedString = "\033[1;31mFAILED (%s)\033[0m" ErrorString = "\033[1;31m%s\033[0m" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ExpectedResponse ¶
type ExpectedResponse struct {
StatusCode int `json:"statusCode"`
Body interface{} `json:"body"`
Headers map[string]string `json:"headers"`
}
Expected test case response
type HttpClient ¶
Mock-able HttpClient interface
type Request ¶
type Request struct {
Method string `json:"method"`
BaseUrl string `json:"baseUrl"`
Url string `json:"url"`
Body interface{} `json:"body"`
Headers map[string]string `json:"headers"`
}
Request information for a single test case
type RunConfig ¶ added in v1.0.0
type RunConfig struct {
BaseUrl string `json:"baseUrl"`
CustomHeaders map[string]string `json:"headers"`
HttpClient HttpClient
}
type TestResult ¶
type TestResult struct {
Passed bool
Skipped bool
Name string
Errors []string
Duration time.Duration
}
Result for an executed test case
func Skipped ¶ added in v1.4.0
func Skipped(name string) TestResult
func (TestResult) Result ¶ added in v1.0.0
func (result TestResult) Result() string
func (TestResult) ResultNoDetail ¶ added in v1.0.0
func (result TestResult) ResultNoDetail() string
type TestSpec ¶
type TestSpec struct {
Name string `json:"name"`
Skip bool `json:"skip"`
Request Request `json:"request"`
ExpectedResponse ExpectedResponse `json:"expectedResponse"`
}
Spec defining a single test case
type TestSuite ¶
type TestSuite struct {
// contains filtered or unexported fields
}
A collection of tests defined within one test file
type TestSuiteResult ¶ added in v1.0.0
type TestSuiteResult struct {
Passed []TestResult
Failed []TestResult
Skipped []TestResult
TestFilename string
TotalTests int
}
Results for an executed TestSuite
func ExecuteSuite ¶ added in v1.0.0
func ExecuteSuite(runConfig RunConfig, testFilename string, logFailureDetails bool) (TestSuiteResult, error)
ExecuteSuite executes a test suite and prints + returns the results
Click to show internal directories.
Click to hide internal directories.