+ 4 - 6 | § ¶NUnit add for MonoDevelop
Yesterday I committed a rewrite of the NUnit addin of MD. The new addin has a lot of new features, and integrates very well with the project system. This is how it looks like:
The addin adds two new pads to MD: the first one is the test tree, which includes a sub-pad that shows information about the currently selected test. The second pad is the results pad. This is created when you start a test session from the tree.
So, what does the test tree show? it is a view of the test structure provided by the currently opened solution. It'll show all tests provided by all projects in the solution (and contained solutions). There are two kind of projects that the addin takes into account to build the tree:
- NUnit library projects: that is, any project that generates a dll (in any language) and that contains references to NUnit will be added to the tree. The addin automatically parses the dll and fills the tree. The parsing of the dll is done in background and in an external process, so you can re-compile it as many times as you want and the tree will be automatically updated.
- NUnit assembly collections: This is a new kind of project which is
just a collection of references to existing NUnit assemblies. This may
be useful if you have some tests in a dll you want to run, but the dll
is generated by some other process outside of MD.

The tests are also run out of the MD process, so MD stability is not compromised, and you can freely change, recompile and run the tests as many times as you want (this is a problem in GNunit, since if you change the dll or any related library you need to reastart and reload the tests).
The addin keeps an history of test runs and results, and you can easily browse them using the results chart and the test details window. The chart shows the progress of successful runs and failures in a graphical way, and it is also used as a date selector. The list below the chart shows a sumary of results for the test selected in the tree and at the date selected in the chart. There are in fact three lists: one that shows a results summary of the child tests, another one that shows all failed test cases, and the last one shows a list of test regressions.
To see test regressions you need to select two dates, and the list will be filled with tests that worked fine in the first date but failed in the second date:

The chart has several options in the context menu, one of them is showing the time spent running the test, instead of the results:

The results are stored in a directory under the project or solution directory.
The addin has support for project configurations. So for example, you could have a project with two configurations, one for .NET 1.1 and another one for .NET 2.0, that would generate a different dll for each configuration. Information about tests and its results is stored independently for each configuration. So, if you change the active configuration (by using the new configuration selector in the toolbar) you'll see how the test tree is updated and the details pad shows the data for the new configuration.
From the implementation point of view, what's interesting to notice is the plethora of extensions the addin is using:
- A new service: NUnitService.
- Two new pads: the test tree and the results pad.
- A new project type.
- Extension of the project pad to add node builders for the new project type.
- New contextual menus for the new project type.
- A new project template.
- A custom file format for the new project type.
- It defines a new property in existing project configuration objects, in which it stores test options (taking advantage of the IExtendedDataItem interface).
It's nice to see that the architecture redesign done in the last months is being so useful. I hope this will engage other people in writing addins for MD, it's real fun, I promise.