Executes a given function against a new Req constructed from the given HttpServletRequest.
Executes a given function against a new Req constructed from the given HttpServletRequest. If useLiftRules is set to true, then LiftRules.early, LiftRules.statelessRewrite, and LiftRules.statelessTest rules are applied.
Executes a given function against a new Req constructed from the given url/path String and contextPath.
Executes a given function against a new Req constructed from the given url/path String and contextPath. See MockHttpServletRequest.processUrl for details on the url String format, and see testReq(HttpServletRequest) for more details on how the Req is processed.
Sets up S based on the provided request and a new session.
Sets up S based on the provided request and session.
Sets up S based on the provided request and session. You can use this method if you want to do special setup on the request outside of what is handled by the MockHttpServletRequest constructor, or if you want to use a different mock impl.
You can provide your own session if you want to simulate sharing a session across multiple requests. See testS(String,String,Box[LiftSession]) for an example of this use.
Note that if useLiftRules is set to true, then rules like LiftRules.early, LiftRules.statelessTest, etc, will be applied.
The request to be used for this test
The LiftSession to use for this request. Passing Empty will force creation of a new session
The function to be executed in the scope of a new S
Sets up S based on the provided url, contextPath and session.
Sets up S based on the provided url, contextPath and session. You can provide your own session if you want to simulate sharing a session across multiple requests. For example:
object testVar extends SessionVar[String]("Empty") val testSession = testS("http://foo.com/test") { testVar("Foo!") S.session // returns the current session } // A second test testS("http://foo.com/test2", session = testSession) { testVar.is must_== "Foo!" }
The url to use for this request. Can either be a full URL, or just the path and queryString. See MockHttpServletRequest.processUrl for more details
The LiftSession to use for this request. If you don't provide one a new one will be created for you
The servlet context path for this request
The function to be executed in the scope of a new S
Setting this var to true
will force all tests to use LiftRules.
Setting this var to true
will force all tests to use LiftRules. See
useLiftRules for more granular control.
This is a utility method to allow you to set the S.
This is a utility method to allow you to set the S.currentSnippet method for testing.
The snippet name to be tested. For example, <lift:MyWidget.foo/> has a
name of MyWidget.foo. You can retrieve this via S.currentSnippet
or
S.invokedAs
The list of snippet tag attributes. Defaults to Null. See S.attrs
for more details
The function to execute in the context of the emulated snippet
The MockWeb object contains various methods to simplify unit testing in Lift outside of the full-blown testkit stack.
There is partial support for configuration defined in the LiftRules object. This includes: