Open ianrhamilton opened 10 years ago
Hi Ian, Yes, unfortunately it doesn't currently work that way as the default approach is for the cucumber plugin to fork a new JVM instance in order to run cucumber. There are two approaches to solving the problem:
1) The cucumber plugin supports a configuration option to pass JVM arguments to the forked JVM used to run cucumber. Add this into your sbt build file: ( https://github.com/skipoleschris/xsbt-cucumber-plugin#jvm-settings)
cucumberSystemProperties := Map("browser" -> "chrome", "environment" -> "dev")
2) Use the plugin in "Integration Test Framework" mode rather than the default "Test Framework" mode. There are some restrictions in configuration and project setup for integration tests, but these run in the same JVM process as sbt and thus should have access to the JVM level environment variables. ( https://github.com/skipoleschris/xsbt-cucumber-plugin#usage---integration-test-framework )
Hope that helps.
I'd also consider supporting a change request to pass the JVM environment properties used by sbt into cucumber when I fork the cucumber JVM. Add an issue if you'd like this support and I'll try to take a look next time I get a free hour or two.
Regards, Chris
On 9 July 2014 08:26, Ian Hamilton notifications@github.com wrote:
Maybe I am mistaken so papologies if I am wrong. But it is not possible to pass a system property via comman line when executing cucumber?
For example I have been trying the follwoing:
sbt -Dbrowser=chrome Denvironment=dev 'cucumber'
I have tried several variations on the above without success, could this pottentially be an issue or am I doing something wrong?
Thanks, Ian
— Reply to this email directly or view it on GitHub https://github.com/skipoleschris/xsbt-cucumber-plugin/issues/45.
Hi Chris,
Thanks very much for the speedy response!
Option 1 works great as I can pass it via command line like the following:
sbt 'set cucumberSystemProperties := Map("environment" -> "dev")' cucumber
Thanks again! -Ian
Maybe I am mistaken so papologies if I am wrong. But it is not possible to pass a system property via comman line when executing cucumber?
For example I have been trying the follwoing:
sbt -Dbrowser=chrome Denvironment=dev 'cucumber'
I have tried several variations on the above without success, could this pottentially be an issue or am I doing something wrong?
Thanks, Ian