1

It would be great to improve test driven development productivity by automatically firing of tests whenever there is a code change.

This is what I'm hoping for.

  1. Whenever a Scala file is saved, SBT (or a shell script) should execute the ScalaTest or Specs2 specifications.
  2. If the tests complete, the system should play a sound indicating success or failure

I'm using Scala IDE to do development and SBT to run my test specs at the moment, so just autimating the steps above would save a person from switching to the console, running the test specs and waiting for the result.

Any ideas automatically firing of the tests and playing a 'succeed' or 'fail' sound would be great.

Jack
  • 16,506
  • 19
  • 100
  • 167
  • In sbt, if you run `~test-quick`, it will rerun tests, that call the changed code and dependencies, or failed during the last run. More info: http://twitter.github.io/scala_school/sbt.html – George Apr 17 '13 at 08:51
  • Now how did I miss that!? Thanks @folone. That already helps a LOT! – Jack Apr 17 '13 at 09:10

1 Answers1

3

Why not create a custom SBT task that depends on the test task. You could add the code for playing the sound to your build definition.

See here how to run a custom task after another task.

To automatically re-run tests, simply prefix the newly define task with a ~ in the SBT shell before running it.

Community
  • 1
  • 1
axel22
  • 32,045
  • 9
  • 125
  • 137
  • This did the trick thanks. Currently I'm trying to find out how to play a sound if the tests fail (http://stackoverflow.com/q/16057378/828757) The fun never ends ;-) – Jack Apr 17 '13 at 11:10