Latish Sehgal's Blog

Continuous Testing Using AutoTest.Net

My friend Brett posted the following on twitter a couple of days ago.

So AutoTest goes on my list of things to play with over the weekend, you know because I could use some giddiness in my life right now. I haven’t been regular with my Ruby hacking, so I decided to check out AutoTest.Net, the .Net counterpart for the same framework. AutoTest.Net was created all the way back in Nov 2007 by James Avery (I live on the bleeding edge, don’t I). Lately, it is being maintained and worked on by Svein Arne Ackenhausen on GitHub.

To get started, download the latest code from GitHub and build it. I initially tried downloading just the binaries and making it work, but kept on getting errors. I think the binaries at this time are out of sync with the latest source code so I would recommend compiling the code yourself. Update the AutoTest.config with the correct location for your build executable as well as your test runners. Now if you launch AutoTest.WinForms.exe, it’ll look something like this:

Choose your code directory and click on “Ok”, and it should be up and running.

If I make a change to a source file now, AutoTest.Net runs all the unit tests for me.

Pretty neat, huh! Now, if you do not have a dual monitor setup, it might be kind of a pain to navigate to the status window every time you make a change to ensure that everything is green. The icing on the cake is that AutoTest.Net integrates with Growl for Windows. After turning on growl, I get:

And, if I add a failing test, I get

So I can continue coding without having to move focus to another application and get continuous feedback at the same time. Brett was right, this setup does make me feel pretty excited. I am definitely going to use this in my side projects, where I have been following a TDD workflow lately. For all you cross-platform folks, AutoTest.Net works with Mono as well. And based on the commit history, it looks like that Svein is checking in updates and fixes very regularly, kudos to him for that.

A couple of things to remember:

  • If your tests start running in an infinite loop, that’s because AutoTest.Net is being triggered by updates in your TestResults. Use the “IgnoreFile” element in the config to specify an ignore file (similar to .gitignore), and AutoTest.Net wil ignore those changes.
  • If you run into any issues, set the “Debugging” element to “true” in the AutoTest.Config file, and monitor the Debug.log file in your AutoTest.Net directory. That is how I found the previous issue.