Reputation: 383
I'm searching for a simple solution for passing parameters to tests (using env vars, additional files not suitable. I need to pass values via command line) Currently I have following solution: Passing parameters via SBT_OPTS:
SBT_OPTS="-DparamName=value" sbt moduleName/test
And retrieving value in test:
Option(System.getProperty("myProperty")).getOrElse("defaultValue")
Unfortunately this solution doesn't fit any more. Are there any simple solutions like this, but without using SBT_OPTS?
Thanks.
Upvotes: 6
Views: 2165
Reputation: 383
Command:
sbt -Dparam=value module/test
Retrieving value:
sys.props.getOrElse("param", DEFAULT_VALUE)
Upvotes: 4