Reputation: 20370
I have a simple Scala 2.11.8 + ScalaTest 3.0.1 + SBT project.
I want to run a single ScalaTest Suite class. I created a trivial example test suite org.example.TestSuite
:
package org.example
import org.scalatest.FunSuite
class TestSuite extends FunSuite {
test("just a simple example test") {
assert(1 + 1 === 2)
}
}
I can run it in isolation from IntelliJ perfectly fine.
When I try to run this in isolation on the command line:
sbt test-only org.example.TestSuite
That runs all of my tests.
I look at the docs here: http://www.scalatest.org/user_guide/using_scalatest_with_sbt
And it says to do exactly what I'm doing, test
runs everything, while test-only <qualified suite class names>
runs just specified suites. However, it just isn't working.
This seems outrageously simple but it's just not working and running all tests. Thank you!
Upvotes: 1
Views: 2112
Reputation: 730
In your command line, SBT will take commands with arguments such as yours by enclosing the command and the arguments in quotes:
sbt 'test-only org.example.TestSuite'
If you enter SBT's command line, then you don't need to specify the quotes and just run your command like:
$ sbt
> test-only org.example.TestSuite
Note that this last example is how the examples in the documentation link you have posted were meant to be used.
Please note also that in more recent SBT versions such as 0.13 the command invocation was changed to testOnly
.
Upvotes: 2