import "github.com/revel/revel/testing"
var TestSuites []interface{} // Array of structs that embed TestSuite
This is populated by the generated code in the run/run/go file
func (r *TestRequest) MakeRequest()
MakeRequest issues any request and read the response. If successful, the caller may examine the Response and ResponseBody properties. You will need to manage session / cookie data manually
func (r *TestRequest) Send()
Send issues any request and reads the response. If successful, the caller may examine the Response and ResponseBody properties. Session data will be added.
type TestSuite struct { Client *http.Client Response *http.Response ResponseBody []byte Session session.Session SessionEngine revel.SessionEngine }
NewTestSuite returns an initialized TestSuite ready for use. It is invoked by the test harness to initialize the embedded field in application tests.
func NewTestSuiteEngine(engine revel.SessionEngine) TestSuite
Define a new test suite with a custom session engine
AssertContains asserts that the response contains the given string.
AssertContainsRegex asserts that the response matches the given regular expression.
AssertNotContains asserts that the response does not contain the given string.
BaseUrl returns the base http/https URL of the server, e.g. "http://127.0.0.1:8557". The scheme is set to https if http.ssl is set to true in the configuration file.
Delete issues a DELETE request to the given path and stores the result in Response and ResponseBody.
func (t *TestSuite) DeleteCustom(uri string) *TestRequest
DeleteCustom returns a DELETE request to the given URI in a form of its wrapper.
Get issues a GET request to the given path and stores the result in Response and ResponseBody.
func (t *TestSuite) GetCustom(uri string) *TestRequest
GetCustom returns a GET request to the given URI in a form of its wrapper.
Host returns the address and port of the server, e.g. "127.0.0.1:8557"
func (t *TestSuite) NewTestRequest(req *http.Request) *TestRequest
NewTestRequest returns an initialized *TestRequest. It is used for extending testsuite package making it possibe to define own methods. Example:
type MyTestSuite struct { testing.TestSuite } func (t *MyTestSuite) PutFormCustom(...) { req := http.NewRequest(...) ... return t.NewTestRequest(req) }
Patch issues a PATCH request to the given path, sending the given Content-Type and data, and stores the result in Response and ResponseBody. "data" may be nil.
PatchCustom returns a PATCH request to the given URI with specified Content-Type and data in a form of wrapper. "data" may be nil.
Post issues a POST request to the given path, sending the given Content-Type and data, storing the result in Response and ResponseBody. "data" may be nil.
PostCustom returns a POST request to the given URI with specified Content-Type and data in a form of wrapper. "data" may be nil.
PostFile issues a multipart request to the given path sending given params and files, and stores the result in Response and ResponseBody.
func (t *TestSuite) PostFileCustom(uri string, params url.Values, filePaths url.Values) *TestRequest
PostFileCustom returns a multipart request to the given URI in a form of its wrapper with the given params and files.
PostForm issues a POST request to the given path as a form post of the given key and values, and stores the result in Response and ResponseBody.
PostFormCustom returns a POST request to the given URI as a form post of the given key and values. The request is in a form of TestRequest wrapper.
Put issues a PUT request to the given path, sending the given Content-Type and data, storing the result in Response and ResponseBody. "data" may be nil.
PutCustom returns a PUT request to the given URI with specified Content-Type and data in a form of wrapper. "data" may be nil.
PutForm issues a PUT request to the given path as a form put of the given key and values, and stores the result in Response and ResponseBody.
PutFormCustom returns a PUT request to the given URI as a form put of the given key and values. The request is in a form of TestRequest wrapper.
WebSocket creates a websocket connection to the given path and returns it
WebSocketUrl returns the base websocket URL of the server, e.g. "ws://127.0.0.1:8557"
Package testing imports 18 packages (graph) and is imported by 144 packages. Updated 2018-10-31. Refresh now. Tools for package owners.