Reputation: 5049
For my specific reason, I'd like to override test
task to run not all tests, but to behave like test-only TopTestSuiteName param1 param2
. Is it possible?
I tried to go through documentation on tasks and examples, but still far from understanding what is possible and what's not.
Or maybe I could create custom task and somehow use existing test-only
functionality? I feel it is reasonable but completely cannot understand - where do I start.
Upvotes: 1
Views: 812
Reputation: 30508
I would suggest you leave test
alone and add a custom thing instead.
How about an alias? You could just add this to your .sbt
definition:
addCommandAlias("myTest", "testOnly TopTestSuiteName -- param1 param2")
But if you actually need myTest
to be a task (for example if you want another task to depend on it), then here's code (in .sbt
format for sbt 0.13) for reusing testOnly
functionality in a custom task:
val myTest = taskKey[Unit]("call testOnly with some special args")
myTest in Test :=
(testOnly in Test).toTask(" TopTestSuiteName -- param1 param2").value
Upvotes: 5