Follow @RoyOsherove on Twitter

NDemo - Demo Driven Development?

One of the people I met in DevTeach yesterday was Ben Monro. I'm pretty sure this is his blog. Ben asked me if I've heard of NDemo (same concept as JDemo which I've also never heard of). No I didn't. But it sounded cool!

Ben is the creator of NDemo, and here's what the site has to say about it:

"NDemo is an open source framework for creating automated testable demonstrations in .NET.  With NDemo, .NET developers can create automated demos in much the same way they create NUnit tests.  With these automated demos, screenshots and walk-thru's can be generated from the real working application.

At the current moment, NDemo is still in the early stages of development.  Although this project uses JDemo as an influence, the framework is being built from the ground up in C#.  This project came in part from my frustration with documentation and always having to keep screenshots up to date.  Why not have a tool that generates them for you, and as a side effect, ends up providing cursory level tests on the GUI.?"

Ben has an interesting post on how he views a technique he calls Demo Driven Development, and how it fits in with Agile development.

Here's another demo taken seamlessly from that site:

The Following example shows a hello world in NDemo.  The syntax is intended to be similar to NUnit.  Notice how the Demo methods return a Demonstrator object.  This object will be used by the demo runner when it runs the demo.

using NDemo.Framework;

namespace NDemo.Sample.Demos
    public class HelloWorldFixture
        public Demonstrator HelloWorld()
            HelloWorldForm form = new HelloWorldForm();
            FormDemonstrator demo = new FormDemonstrator(form);

            demo.ClickOn("btnHello").Show("First Click on the Hello Button");

            demo.Highlight("lblWorld").Show("World will then appear here.");

            return demo;

The Demo Runner (the GUI Runner) will actually show screenshots of the UI with the objects highlighted and with the specific annotations on top of these images. That way you could, for example, create automatic testing steps for your QA, even if your UI changes, the screenshots change with it (this can be automated as part of a daily build. It's also a good way to create visual use cases of the application for customers.

It's an interesting approach. When I showed this to Oren(Ayende) he asked whether it only works on winforms.I wasn't sure but I think so. It's built on top of NUnitForms, if I'm not mistaken. Oren was excited to see that the site has a cool "Tested with RhinoMocks" graphic as well :)

Cool work Ben! I'd love to see real life demos (no pun intended!) of this thing.

Learning new technologies: Is C# a XAML for the CLR?

Slides and demos for talk: Techniques for testing Data Access Code