Sonson123
Sonson123

Reputation: 11427

Resource directory for tests in a Play application

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.

Upvotes: 28

Views: 7041

Answers (3)

Michel Verbist
Michel Verbist

Reputation: 1

or nowadays, less deprecated:

$ sbt "show Test/resourceDirectory"
...
[info] /path/to/project/test/resources

Upvotes: 0

user1338062
user1338062

Reputation: 12735

Elevating SathOkh's comment for more visibility.

With sbt 1.3.13:

$ sbt "show test:resourceDirectory"
...
[info] /path/to/project/test/resources

Upvotes: 3

Schleichardt
Schleichardt

Reputation: 7542

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.

Upvotes: 49

Related Questions