Friday, February 7, 2014

Tell me when my cukes are done

So your test suite takes a few minutes to run. That is valuable time to go check Twitter. Of course, you don't want to get sucked too far into the Twitterverse and want to only read tweets while rake is running your suite.

Let iTerm tell you when your tests are done! iTerm will let you define a trigger and then perform an action when your trigger is set off.

Let's assume that rake will spit out some text when your cukes are all done:

Took 65.38276 seconds

Convert that to a regular expression and use it as your iTerm trigger:

^Took \d+.\d+ seconds

Now, let's define the trigger. When your iTerm matches that regular expression, iTerm will execute a the /usr/bin/say command on the Mac to convert some text to speech.

Open your iTerm preferences.



Click the "Edit" button in the Triggers section and use your regular expression to define the trigger:



Now, when your iTerm encounters text like "Took 65.1234 seconds" your Mac will say "Your tests are done."