Book Image

Play Framework Essentials

By : Julien Richard-Foy
Book Image

Play Framework Essentials

By: Julien Richard-Foy

Overview of this book

Table of Contents (14 chapters)
Play Framework Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Testing your web service


The architecture of your web service is depicted in the following diagram:

This section presents the testing libraries that are integrated with Play and the testing infrastructure provided by Play to test the HTTP layer of your web service.

Writing and running tests

As Play projects are just sbt projects by default, you can add tests to your Play project just as you would do for any other sbt project, except that the root directory for test sources is not src/test/scala/ but simply test/.

sbt provides a mechanism to integrate testing libraries so that their tests can be run from the build system. The testing component of Play integrates two testing libraries out of the box: specs2 for Scala tests and JUnit for Java tests. Play projects automatically depend on the Play testing component, so you don't need to add this dependency in your build.sbt file. Obviously, you are free to use any other testing library supported by sbt—just follow their usage instructions.

Note

Though...