Documentation ¶
Index ¶
- type CustomTestFunc
- type H
- type Request
- func ConnectRequest(path string, headers ...H) Request
- func DeleteJsonRequest(path, body string, headers ...H) Request
- func DeleteRequest(path, body string, headers ...H) Request
- func GetJsonRequest(path string, headers ...H) Request
- func GetRequest(path string, headers ...H) Request
- func HeadRequest(path string, headers ...H) Request
- func OptionsRequest(path string, headers ...H) Request
- func PatchJsonRequest(path, body string, headers ...H) Request
- func PatchRequest(path, body string, headers ...H) Request
- func PostJsonRequest(path, body string, headers ...H) Request
- func PostRequest(path, body string, headers ...H) Request
- func PutJsonRequest(path, body string, headers ...H) Request
- func PutRequest(path, body string, headers ...H) Request
- func TraceRequest(path string, headers ...H) Request
- type Response
- type T
- type TestCase
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CustomTestFunc ¶ added in v0.2.0
CustomTestFunc is a type of function that implements its own validation
type Request ¶
type Request struct { // Method is the request method // // see https://github.com/golang/go/blob/master/src/net/http/method.go for available methods. Method string // Path is the request path. // // since we will be using an internally started test server, the scheme, domain, and port are not necessary. Path string // Headers is the request headers Headers []H // Body is the request body Body string }
Request is the type for manage request parameters.
func ConnectRequest ¶
ConnectRequest is the helper that returns the configuration for sending a CONNECT request
func DeleteJsonRequest ¶
DeleteJsonRequest is the helper that returns the configuration for sending a DELETE request with a JSON format body.
func DeleteRequest ¶
DeleteRequest is the helper that returns the configuration for sending a DELETE request
func GetJsonRequest ¶
GetJsonRequest is the helper that returns the configuration for sending a GET request with a JSON format body.
func GetRequest ¶
GetRequest is the helper that returns the configuration for sending a GET request
func HeadRequest ¶
HeadRequest is the helper that returns the configuration for sending a HEAD request
func OptionsRequest ¶
OptionsRequest is the helper that returns the configuration for sending a OPTIONS request
func PatchJsonRequest ¶
PatchJsonRequest is the helper that returns the configuration for sending a PATCH request with a JSON format body.
func PatchRequest ¶
PatchRequest is the helper that returns the configuration for sending a PATCH request
func PostJsonRequest ¶
PostRequest is the helper that returns the configuration for sending a POST request with a JSON format body.
func PostRequest ¶
PostRequest is the helper that returns the configuration for sending a POST request
func PutJsonRequest ¶
PutJsonRequest is the helper that returns the configuration for sending a PUT request with a JSON format body.
func PutRequest ¶
PutRequest is the helper that returns the configuration for sending a PUT request
func TraceRequest ¶
TraceRequest is the helper that returns the configuration for sending a TRACE request
type Response ¶
type Response struct { // Status is the response status code Status int // Headers is the response headers Headers []H // Body is the response body Body string }
Response is the type for manage response parameters.
func JsonResponse ¶
JsonResponse returns the structure of the expected value of the JSON response. charset is specified as utf-8.
func JsonResponseWithoutCharset ¶
JsonResponse returns the structure of the expected value of the JSON response. No charset is specified.
type T ¶
type T struct {
// contains filtered or unexported fields
}
T is the type for manage API tests.
func (*T) SetUpBeforeTest ¶
SetUpBeforeTest set up a function that all test cases will run before execution
func (*T) TearDownAfterTest ¶
TearDownAfterTest set up a function that all test cases will run after execution
type TestCase ¶
type TestCase struct { // Name is the name of the test case Name string // SetUp is the function that runs before the API is executed. // // This function performs preprocessing such as migration, test data creation, etc. SetUp func(*testing.T) // TearDown is the function that runs after the API is executed // // This function perform post-processing such as deleting test data, deleting tables, etc. TearDown func(*testing.T) // CustomTestFuncs is a set of functions used when you want to perform validation other // than HTTP status, response header, and response body validation. // // Each `CustomTestFunc` works in series. // // If you use `t.Fatal()`, `t.Fail()`, etc. in a `CustomTestFunc`, // the process will be interrupted and the subsequent `CustomTestFunc` will not be processed. CustomTestFuncs []CustomTestFunc // Request is the request parameter of the API Request Request // Response is the response parameter of the API Response Response }
TestCase is the type for manage API test cases