I'm integration testing a Play Framework app using ScalaTest. This:org.scalatest.Suites(list-of-specifications)
executes each test in the list-of-specifications. But how can I avoid each specification being executed independently as well? They're being executed twice.
An example:
import org.scalatest.{Suites, FreeSpec}
class BrowserSuiteSpec extends Suites(new AnonLoginSpec)
class AnonLoginSpec extends FreeSpec { ... }
Now my AnonLoginSpec
is executed twice – first as part of the BrowserSuiteSpec, then independently, since it's a FreeSpec class. (Changing AnonLoginSpec
to a trait results in a compilation errror.)
Renaming AnonLoginSpec
to AnonLoginSpeX
didn't have any effect — it's still being executed twice.
(I thought perhaps ScalaTest was looking for the "Spec" suffix, which I think Specs2 does.)
The documentation doesn't mention this issue (as far as I can tell).
If you are using ScalaTest 2.0.M5 or later, you can annotate each suite with @DoNotDiscover. Alternatively, you can bypass discovery and just specify the main suite class name by passing -s MainSuite to the ScalaTest runner.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With