Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if sbt in test context?

Tags:

testing

scala

sbt

How can an application tell if it's running under an 'sbt test' context? Is there a system property that can be checked?

like image 532
jvliwanag Avatar asked Nov 02 '14 00:11

jvliwanag


1 Answers

There are probably different ways. I found the following works:

testOptions += Tests.Setup(_ => sys.props("testing") = "true")

And then you can just test for sys.props.get("testing") in your class.

like image 186
0__ Avatar answered Oct 03 '22 05:10

0__