Documentation
¶
Index ¶
Constants ¶
View Source
const ( 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"`
}
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"`
}
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 ¶
Result for an executed test case
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"`
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
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)
Execute a test suite and print + return results
type TestSuiteSpec ¶ added in v1.0.0
type TestSuiteSpec struct {
IgnoredFields []string `json:"ignoredFields"`
BaseUrl string `json:"baseUrl"`
Tests []TestSpec `json:"tests"`
}
Spec defining the tests in a suite
Click to show internal directories.
Click to hide internal directories.