播放application.conf - 测试配置

时间:2012-09-06 16:42:37

标签: playframework playframework-1.x

在Play application.conf 中,我有默认值,%test%stage%prod值:

%stage.application.mode=prod
%prod.application.mode=prod
%test.application.mode=test

#default values
property=someValue

%test.property=testValue

%stage.property=stageValue

%prod.property=prodValue

我无法更改这些内容,因为当应用程序部署到相应的环境时会使用它们。

但是,我需要能够在测试模式下启动Play,以便在本地计算机上进行单元测试,其设置与%test中的设置不同。

有没有办法添加另一个测试配置,比如%unittest并使用这些配置在测试模式下启动Play( play test )?

1 个答案:

答案 0 :(得分:4)

它实际上是相反的:

您定义

%test-unit.application.mode=dev

重要提示:前缀必须为test-

并设置值

%test-unit.property=testValue

最后,您需要在命令行上设置Play服务器的“id”:

$ play id

,对于此示例,它将是test-unit

参考:http://www.playframework.org/documentation/1.2.5/guide11

相关问题