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

Using an in-memory database for tests


You now have all the required knowledge to make your web service persistent. Once you have chosen a database technology, select the Play plugins you need (JDBC, JPA, and so on), configure your data sources right from your application.conf file, use the database helper classes provided by the plugins to integrate with your database technology, and finally implement your business layer on top of your database layer.

Once you have made your business layer persistent, you probably want to run your tests to check whether you introduced a regression. However, you will unexpectedly get the following error:

[info] A Shop should
[info] ! add items
[error]    RuntimeException: : There is no started application  (Play.scala:71)

What happened? Remember that your database configuration is read by your Play application at startup and then used by your database layer. The key step is when you retrieve the data source—remember that the method takes an implicit parameter...