Jonik
Jonik

Reputation: 81820

Getting test-only to work outside SBT console

I'm using Specs2 for tests, with latest Play, Scala and SBT.

In sbt console, this works great, running only tests in UserServiceSpec:

[my-project] $ test-only services.UserServiceSpec

Outside sbt console, in project root directory, this does not work:

$ sbt test-only services.UserServiceSpec      

This runs all the tests. (Same happens with testOnly.)

How is test-only supposed to work outside sbt console?

Follow-up question: using Specs2 tags, how to execute only tagged tests on the command line, outside sbt console?

$ sbt test-only -- include unit

The above, again, tries to to execute all tests (while test-only -- include unit in sbt console works fine).

Basically, I'd like to run all unit tests on a CI server, and Specs2 tags seem like a good tool for separating different kinds of tests. In this scenario I couldn't use the sbt console, right?

Upvotes: 2

Views: 473

Answers (1)

vvg
vvg

Reputation: 6395

Sbt consider two parameters as two separate commands. You should mark it as one.

Try: sbt "testOnly services.UserServiceSpec"

Upvotes: 7

Related Questions