On Mon, 25 Feb 2013 17:14:40 +0400
Eugene Vigdorchik <
eugene.v...@gmail.com> wrote:
> On Thu, Jan 3, 2013 at 11:52 PM, Jaka Jančar <
ja...@kubje.org> wrote:
> > Hi,
> >
> > Some of my classes, upon initialization (in companion object body), read an
> > environment variable.
> >
> > I need this environment variable to be set when running tests, before the
> > classes are loaded.
> >
> > Is there a way to do it with sbt / ScalaTest?
> The easiest way looks to fork the tests and give the variables as java options:
>
> fork in Test := true,
> javaOptions in Test := Seq("-Dyour.option=value")
Yes, if system properties are acceptable, that is the best way. In 0.13.0, environment variables may be set for forking run and test by configuring the envVars task: