Packages

  • package root
    Definition Classes
    root
  • package play

    Play framework.

    Play framework.

    Play

    http://www.playframework.com

    Definition Classes
    root
  • package api

    Contains the public API for Scala developers.

    Contains the public API for Scala developers.

    Access the current Play application
    import play.api.Play.current
    Read configuration
    val poolSize = configuration.getInt("engine.pool.size")
    Use the logger
    Logger.info("Hello!")
    Define a Plugin
    class MyPlugin(app: Application) extends Plugin
    Create adhoc applications (for testing)
    val application = Application(new File("."), this.getClass.getClassloader, None, Play.Mode.DEV)
    Definition Classes
    play
  • package cache

    Contains the Cache access API.

    Contains the Cache access API.

    Definition Classes
    api
  • package controllers
    Definition Classes
    api
  • package data

    Contains data manipulation helpers (typically HTTP form handling)

    Contains data manipulation helpers (typically HTTP form handling)

    import play.api.data._
    import play.api.data.Forms._
    
    val taskForm = Form(
      tuple(
        "name" -> text(minLength = 3),
        "dueDate" -> date("yyyy-MM-dd"),
        "done" -> boolean
      )
    )
    Definition Classes
    api
  • package db

    Contains the JDBC database access API.

    Contains the JDBC database access API.

    Example, retrieving a connection from the 'customers' datasource:

    val conn = db.getConnection("customers")
    Definition Classes
    api
  • package http

    Contains standard HTTP constants.

    Contains standard HTTP constants. For example:

    val text = ContentTypes.TEXT
    val ok = Status.OK
    val accept = HeaderNames.ACCEPT
    Definition Classes
    api
  • package i18n

    Contains the internationalisation API.

    Contains the internationalisation API.

    For example, translating a message:

    val msgString = Messages("items.found", items.size)
    Definition Classes
    api
  • package inject

    Play's runtime dependency injection abstraction.

    Play's runtime dependency injection abstraction.

    Play's runtime dependency injection support is built on JSR-330, which provides a specification for declaring how dependencies get wired to components. JSR-330 however does not address how components are provided to or located by a DI container. Play's API seeks to address this in a DI container agnostic way.

    The reason for providing this abstraction is so that Play, the modules it provides, and third party modules can all express their bindings in a way that is not specific to any one DI container.

    Components are bound in the DI container. Each binding is identified by a BindingKey, which is typically an interface that the component implements, and may be optionally qualified by a JSR-330 qualifier annotation. A binding key is bound to a BindingTarget, which describes how the implementation of the interface that the binding key represents is constructed or provided. Bindings may also be scoped using JSR-330 scope annotations.

    Bindings are provided by instances of Module.

    Out of the box, Play provides an implementation of this abstraction using Guice.

    Definition Classes
    api
    See also

    The Module class for information on how to provide bindings.

  • package libs

    Contains various APIs that are useful while developing web applications.

    Contains various APIs that are useful while developing web applications.

    Definition Classes
    api
  • package mvc

    Contains the Controller/Action/Result API to handle HTTP requests.

    Contains the Controller/Action/Result API to handle HTTP requests.

    For example, a typical controller:

    class HomeController @Inject() (val controllerComponents: ControllerComponents) extends BaseController {
    
      def index = Action {
        Ok("It works!")
      }
    
    }
    Definition Classes
    api
  • package routing
    Definition Classes
    api
  • package templates
    Definition Classes
    api
  • package test

    Contains test helpers.

    Contains test helpers.

    Definition Classes
    api
  • CSRFTokenHelper
  • DefaultAwaitTimeout
  • EssentialActionCaller
  • FakeHeaders
  • FakeRequest
  • FakeRequestFactory
  • FutureAwaits
  • Helpers
  • Injecting
  • NoMaterializer
  • NoTemporaryFileCreator
  • PlayRunners
  • PlaySpecification
  • ResultExtractors
  • RouteInvokers
  • StubBodyParserFactory
  • StubControllerComponentsFactory
  • StubMessagesFactory
  • StubPlayBodyParsersFactory
  • TestBrowser
  • TestServer
  • WebDriverFactory
  • WithApplication
  • WithApplicationLoader
  • WithBrowser
  • WithServer
  • Writeables
  • WsTestClient
p

play.api

test

package test

Contains test helpers.

Source
package.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. test
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. trait DefaultAwaitTimeout extends AnyRef
  2. trait EssentialActionCaller extends AnyRef
  3. case class FakeHeaders(data: Seq[(String, String)] = Seq.empty) extends Headers with Product with Serializable

    Fake HTTP headers implementation.

    Fake HTTP headers implementation.

    data

    Headers data.

  4. class FakeRequest[+A] extends Request[A]

    A Request with a few extra methods that are useful for testing.

    A Request with a few extra methods that are useful for testing.

    A

    the body content type.

  5. class FakeRequestFactory extends AnyRef

    Helper methods for building FakeRequest values.

  6. trait FutureAwaits extends AnyRef
  7. type HasApp = AnyRef { def app: play.api.Application }

    A structural type indicating there is an application.

  8. trait Injecting extends AnyRef

    A trait declared on a class that contains an def app: Application, and can provide instances of a class.

    A trait declared on a class that contains an def app: Application, and can provide instances of a class. Useful in integration tests.

  9. trait PlayRunners extends HttpVerbs

    Helper functions to run tests.

  10. trait PlaySpecification extends SpecificationLike with PlayRunners with HeaderNames with Status with HttpProtocol with DefaultAwaitTimeout with ResultExtractors with Writeables with RouteInvokers with FutureAwaits with HttpVerbs

    Play specs2 specification.

    Play specs2 specification.

    This trait excludes some of the mixins provided in the default specs2 specification that clash with Play helpers methods. It also mixes in the Play test helpers and types for convenience.

  11. type Port = Int

    Provided as an implicit by WithServer and WithBrowser.

  12. trait ResultExtractors extends AnyRef
  13. trait RouteInvokers extends EssentialActionCaller
  14. trait StubBodyParserFactory extends AnyRef
  15. trait StubControllerComponentsFactory extends StubPlayBodyParsersFactory with StubBodyParserFactory with StubMessagesFactory
  16. trait StubMessagesFactory extends AnyRef
  17. trait StubPlayBodyParsersFactory extends AnyRef
  18. case class TestBrowser(webDriver: WebDriver, baseUrl: Option[String]) extends FluentAdapter with Product with Serializable

    A test browser (Using Selenium WebDriver) with the FluentLenium API (https://github.com/Fluentlenium/FluentLenium).

    A test browser (Using Selenium WebDriver) with the FluentLenium API (https://github.com/Fluentlenium/FluentLenium).

    webDriver

    The WebDriver instance to use.

  19. case class TestServer(config: ServerConfig, application: Application, serverProvider: Option[ServerProvider]) extends Product with Serializable

    A test web server.

    A test web server.

    config

    The server configuration.

    application

    The Application to load in this server.

    serverProvider

    The type of server to use. If not provided, uses Play's default provider.

  20. abstract class WithApplication extends Around with Scope

    Used to run specs within the context of a running application.

  21. abstract class WithApplicationLoader extends Around with Scope

    Used to run specs within the context of a running application loaded by the given ApplicationLoader.

  22. abstract class WithBrowser[WEBDRIVER <: WebDriver] extends Around with Scope

    Used to run specs within the context of a running server, and using a web browser

  23. abstract class WithServer extends Around with Scope

    Used to run specs within the context of a running server.

  24. trait Writeables extends AnyRef
  25. trait WsTestClient extends AnyRef

    A standalone test client that is useful for running standalone integration tests.

Value Members

  1. object CSRFTokenHelper

    Exposes methods to make using requests with CSRF tokens easier.

  2. object FakeRequest extends FakeRequestFactory

    Object with helper methods for building FakeRequest values.

    Object with helper methods for building FakeRequest values. This object uses a play.api.mvc.request.DefaultRequestFactory with default configuration to build the requests.

  3. object Helpers extends PlayRunners with HeaderNames with Status with MimeTypes with HttpProtocol with DefaultAwaitTimeout with ResultExtractors with Writeables with EssentialActionCaller with RouteInvokers with FutureAwaits with StubControllerComponentsFactory
  4. object NoMaterializer extends Materializer

    In 99% of cases, when running tests against the result body, you don't actually need a materializer since it's a strict body.

    In 99% of cases, when running tests against the result body, you don't actually need a materializer since it's a strict body. So, rather than always requiring an implicit materializer, we use one if provided, otherwise we have a default one that simply throws an exception if used.

  5. object NoTemporaryFileCreator extends TemporaryFileCreator

    A temporary file creator with no implementation.

  6. object PlayRunners
  7. object TestBrowser extends Serializable

    Helper utilities to build TestBrowsers

  8. object TestServer extends Serializable
  9. object WebDriverFactory
  10. object WsTestClient extends WsTestClient

Inherited from AnyRef

Inherited from Any

Ungrouped