When I run mvn test -Dsuites=com.example.FooSpec, all of my tests still run as before. In the logs, I can see that FooSpec does get instantiated first, but then I see "Discovery starting" and all the other specs still get instantiated and run:
$ mvn test -Dsuites=com.example.FooSpec
...
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ example_2.11 ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- scalatest-maven-plugin:2.0.0:test (test) @ example_2.11 ---
[INFO] Forking ScalaTest via: /bin/sh -c cd '/path/to/example' && 'java' '-Dbasedir=/path/to/example' 'org.scalatest.tools.Runner' '-R' '/path/to/example/target/classes /path/to/target/test-classes' '-s' 'com.example.FooSpec' '-w' 'com.example' '-o' '-u' '/path/to/example/target/surefire-reports/.'
18/07/21 11:36:52 INFO FooSpec: initiating some stuff
Discovery starting.
18/07/21 11:36:54 INFO BarSpec: initiating some stuff
18/07/21 11:36:54 INFO BazSpec: initiating some stuff
...
Discovery completed in 26 seconds, 444 milliseconds.
Run starting. Expected test count is: 170
FooSpec:
Foo
when stuff happens
- should confidently announce that everything will be fine
BarSpec:
Bar
when stuff happens
- should exhibit an unruffled demeanor
BazSpec:
Baz
when stuff happens
- should stride purposefully over and deal with it
Not sure what I'm missing here. How can I run just the single test I want?
When I run
mvn test -Dsuites=com.example.FooSpec
, all of my tests still run as before. In the logs, I can see thatFooSpec
does get instantiated first, but then I see "Discovery starting" and all the other specs still get instantiated and run:Not sure what I'm missing here. How can I run just the single test I want?