Reputation: 14803
According to the documentation:
The standard testing tasks are available, but must be prefixed with it:. For example,
> IntegrationTest / testOnly org.example.AnIntegrationTest
As described, I added this to my build.sbt
:
lazy val server = (project in file("server"))
.configs(IntegrationTest)
I want to run only integration tests.
So I tried different ways - but none worked:
[IJ][play-binding-form-server] $ it:test
[error] No such setting/task
[error] it:test
...
[IJ][play-binding-form-server] $ IntegrationTest / testOnly org.example.AnIntegrationTest
[error] Expected whitespace character
[error] Expected '/'
[error] IntegrationTest / testOnly org.example.AnIntegrationTest
How is it done correctly?
Upvotes: 9
Views: 9709
Reputation: 7275
You need to enable settings(Defaults.itSettings)
like here
lazy val server = (project in file("server"))
.configs(IntegrationTest)
.settings(Defaults.itSettings)
After this you should be able to run both within sbt
sbt> it:testOnly test.Spec
sbt> IntegrationTest / testOnly test.Spec
Or outside of sbt
as
sbt "it:testOnly test.Spec"
sbt "IntegrationTest / testOnly test.Spec"
Upvotes: 12