When testing a web application, we quickly come upon the problem of setting up a rather complete environment. This environment is meant to contain enough information needed by business workflows. Such unit tests reach the limits of atomic tests and thus can be considered applicative.
Such an environment can be complex because, most of the time, it involves a database or an application context with components such as caching. This task can be cumbersome in other frameworks because they either don't provide the whole stack, like Play! Framework 2 does, or they require several actions (new dependencies, annotations, project-specific configuration, dedicated test runner, and so on) to be implemented.
In Play! 2, applicative tests are handled by the framework itself through the definition of a bunch of helpers and mock-ups.
The key point will be the Application
class, which is responsible for setting up the context of the web application. Indeed, an Application
instance...