Friday, November 12, 2010

NUnit Growl Notification

This is a simple explaination of the NUnit growl notification AddIn.

It has been tested on NUnit 2.5.5. and NUnit 2.5.7.

Here is the main documentation about writing NUnit plugins:

As far as I know to build it correctly you need to add the proper versions of nunit and growl assemblies in the lib directory. In this way I got working builds for Nunit 2.5.5 and 2.5.7.

I tested them in two differenet Windows 7 machines, 64 bit arch.

The target framework is 3.5, and works under 4.0 as well.

The binaries included are for NUnit 2.5.7.

However I included prebuild binaries for Nunit 2.5.7.

I encourage people to rebuild it and test in other platforms.

I found an equivalent project, but no compatibile with other version but Nunit 2.5.5.

I need those tools for games like doing katas with continuous test/build and so on.

Another useful project at it is autobuild:

Hopefully stuffs like those will be used also when writing production code, and no just katas, to make you focus on TDD cycle.

Here is, essentially, how does it work:

  • the interfaces implemented are Iaddin and EventListener

  • the constructor instantiates the notification types and register them to the growlconnector

  • the Install method actually registers the instance in order to make it recognized as an EventListener for nunit related events (suitestarted, teststarted and son on...)

  • the custom behaviour (notification to growl) is coded in methods like RunFinished an so on..

My aim was to visualize, after each build (actually continuous build, using autobuild):

  • an ok, greeen, notification when all the test passes, with the number of test passed

  • a non ok, red, notification when at least one test fails or has an error, with the number of failures and errors, and the number of total tests as well

  • a non ok, red, notification for each failed test, with the actual and expected values specified.

So there will be one green notification of the number of failing and error tests +1 after each build (actually, each source file saved, if using autobuild).

In normal tdd ciclye you will get one green notification or two red notifications, that should be a good reminder that you are supposed to actually work on the failing test to get rid of them.

Some screenshots:

A screenshot of a failing test:

A two and half minutes video:

Nunit AddIn for Growl from tonyx on Vimeo.

Thanks for reading, feedback are welcome.

No comments: