Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing parameter to scala test, which are executed via sbt

Tags:

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.

like image 538
Paul Avatar asked Jun 18 '18 14:06

Paul


1 Answers

Command:

sbt -Dparam=value  module/test

Retrieving value:

 sys.props.getOrElse("param", DEFAULT_VALUE)
like image 176
Paul Avatar answered Sep 28 '22 19:09

Paul