Play framework 2.0. Use alternative application.conf in test

configuration, playframework-2.0, testing

Solution

If you mean for unit tests then just add

running(FakeApplication(additionalConfiguration = inMemoryDatabase())) { Test code... }

to your tests and they will be done in memory. No need to change conf files.

Problem

my Play using mysql in production. But I am trying to use memory for testing. I created 2 conf file, 1 is application.conf, the other is application.test.conf (in the same directory). I tried to do ``` play -Dconfig.file=conf/application.test.conf test-only ``` But it still use the default conf file. I'm just wonder if anyone know how to use a different conf file during testing. (or at least use a different database setting during testing).

Original source