Resource directory for tests in a Play application

2019-02-11 12:32发布

问题:

I need some resources (text files) for my tests in a Scala Play 2.0 application. Where can I put these files?

In a maven app I would put them into src/test/resources, but I cannot find anything about an equal directory in the Play documentation.

I can put them in the confdirectory, but I only need them when I test the application.

回答1:

Call

play "show test:resource-directory"

in the console and it shows you the absolute path to your resource directory in test mode. It will be in "test/resources".

"show" is a sbt command (or task) that enables you to retrieve the values of settings.