Packages

object ServiceTest

Support for writing functional tests for one service. The service is running in a server and in the test you can interact with it using its service client, i.e. calls to the service API.

The server is ran standalone without persistence, pubsub or cluster features enabled. Cassandra is also disabled by default. If your service require either of these features you can enable them in the Setup.

There are two different styles that can be used. It is most convenient to use ServiceTest.withServer(), since it automatically starts and stops the server before and after the given block. When your test have several test methods, and especially when using persistence, it is faster to only ServiceTest.startServer() the server once in a before all tests hook, and then stop it in an after all test hook.

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

Type Members

  1. sealed trait Setup extends AnyRef
  2. final class TestServer[A <: LagomApplication] extends AnyRef

    When the server is started you can get the service client and other Guice bindings here.

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  6. val defaultSetup: Setup

    The default Setup configuration, which has persistence enabled.

  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  12. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  13. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  16. def startServer[T <: LagomApplication](setup: Setup)(applicationConstructor: (LagomApplicationContext) ⇒ T): TestServer[T]

    Start the test server with the given setup.

    Start the test server with the given setup. You must stop the server with the stop method of the returned TestServer when the test is finished.

    When your test have several test methods, and especially when using persistence, it is faster to only start the server once in a static method annotated with @BeforeClass and stop it in a method annotated with @AfterClass. Otherwise withServer() is more convenient.

    You can get the service client from the returned TestServer.

  17. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  18. def toString(): String
    Definition Classes
    AnyRef → Any
  19. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  22. def withServer[T <: LagomApplication, R](setup: Setup)(applicationConstructor: (LagomApplicationContext) ⇒ T)(block: (TestServer[T]) ⇒ R): R

    Start the test server with the given setup and run the block (lambda).

    Start the test server with the given setup and run the block (lambda). When the block returns or throws the test server will automatically be stopped.

    This method should be used when the server can be started and stopped for each test method. When your test have several test methods, and especially when using persistence, it is faster to only start the server once with #startServer.

    You can get the service client from the TestServer that is passed as parameter to the block.

Inherited from AnyRef

Inherited from Any

Ungrouped