Friday, July 12, 2013

Continous Testing with SpecWatchr

I was impressed with Amir Rajan's talk at Austin .Net this week, and was intrigued by his use of the Continuous Testing framework SpecWatchr, so I decided to give it a spin. You can download it at here. I found the installation instructions very clear and concise. You need to download Ruby 1.9.2 and Growl.

By default it assumes nspec, but it was easy enough to change it in dotnet.watchr.rb to be NUnit.

By default SpecWatchr assumes all the tests for MyClass.cs are in a file named "describe_MyClass.cs", which mine were not. Mine tests are in MyClassTest.cs. But since this is open source, I cracked open "watcher_dot_net.rb" and changed half a dozen lines of Ruby and got it to recognize my convention. It worked like a charm.

Amir encouged the .Net group to reduce the friction in development. One of these frictions is to manually save and run tests. With SpecWatchr all you have to do is save a file and it will automagically compile and run affected tests. When all is happy you get this in the corner of your screen for a few seconds.  :
If you have a compile time error you get this:
Things to like about SpecWatchr:
  • It's free!
  • It works.
  • It's well documented.
  • It's easy to install.
Things not to like: You have to annotate your tests with a category, which is the name of the class affected.   I don't see anyway around this without some serious introspection of the code.

Overall SpecWatchr is  a great tool.

No comments: