Play 应用程序中的测试资源目录 [英] Resource directory for tests in a Play application
问题描述
我需要一些资源(文本文件)来在 Scala Play 2.0 应用程序中进行测试.我可以把这些文件放在哪里?
I need some resources (text files) for my tests in a Scala Play 2.0 application. Where can I put these files?
在一个 maven 应用程序中,我会将它们放入 src/test/resources
,但我在 Play 文档中找不到任何关于相等目录的信息.
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.
我可以把它们放在conf
目录下,但我只有在测试应用程序时才需要它们.
I can put them in the conf
directory, but I only need them when I test the application.
推荐答案
调用
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"是一个 sbt 命令(或任务),可以让您检索设置的值.
"show" is a sbt command (or task) that enables you to retrieve the values of settings.
这篇关于Play 应用程序中的测试资源目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!