Overriding configuration for tests
Reported by Alexander Strebkov | February 8th, 2013 @ 04:06 AM
Specifying an alternative configuration file with -Dconfig.file=... or -Dconfig.resource=... is not working for tests. Same with overriding properties with -Dsomevalue=... Everything is fine with "play run" or "play start", but "play test" will ignore those command line options in 2.1.0 and some previous RC's.
More information and sample app from rch850 here:
Btw it looks like for some people this might lead to wiping dev database and populating it with test data.
Comments and changes to this ticket
- State changed from new to tobeconfirmed
- Assigned user set to Nilanjan Raychaudhuri
I can this is quite useful. I need to check whether there is anyway we can do that with 2.1. I know SBT test-only allows you to pass arguments. I need to make sure that Play is not doing anything special
- State changed from tobeconfirmed to wontfix
Yes this is because the tests use now a forked JVM. However there is already a way to specify a specific test configuration for a single test. I'm not sure we should rely on a Global test file defined at the JVM level. Especially if you run test from the Play console, it can't work.
You can pass JVM arguments to the forked test JVM with a .sbt setting:
javaOptions in test += "-Dconfig.file=conf/test.conf"
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »