ScalaTest User Guide
Selecting testing styles
Defining base classes
Writing your first test
Tagging your tests
Running your tests
Testing with mock objects
Philosophy and design
Migrating to 2.0
Using ScalaTest with sbt
libraryDependencies += "org.scalatest" % "scalatest_2.10" % "2.0" % "test"
Your test sources files go into
If you want to run particular suites, use
> test-only org.acme.RedSuite org.acme.BlueSuite
Or you can specify a glob:
> test-only *RedSuite
You can configure the output shown when running with sbt in four ways: 1) turn off color, 2) show
short stack traces, 3) full stack traces, and 4) show durations for everything. To do so you must
For example, "-oDF" would show full stack traces and durations (the amount of time spent in each test).
To pass arguments from sbt to ScalaTest you can either add test options globally, like this:
testOptions in Test += Tests.Argument("-oD")
Or if you are using more than one test framework, like this:
testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-oD")
You can also pass arguments for individual runs by placing them after
> test-only org.acme.RedSuite -- -oD
ScalaTest is brought to you by Bill Venners, with
contributions from several other folks. It is sponsored by
ScalaTest is free, open-source software released under the Apache 2.0 license.
Copyright © 2009-2016 Artima, Inc. All Rights Reserved.