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
{
    [DemoFixture]
    public class HelloWorldFixture
    {
        [Demo]
        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.

Published Wednesday, May 16, 2007 9:05 AM by RoyOsherove
Filed under: ,

Comments

Wednesday, May 16, 2007 9:06 PM by Chris

# re: NDemo - Demo Driven Development?

Hi Roy .NET 3.0 has an automation API that works like this as well (without the annotations). I haven't really looked into NUnitForms, but does anyone know whether it operates with WPF windows well? Chris
Saturday, May 19, 2007 4:49 AM by Ben Monro

# re: NDemo - Demo Driven Development?

Hi Roy, Thanks for the post. I am working on putting together an installer release, but right now you can check out the svn code and run the app from the IDE. Its still in the proof of concept phase, but part of the reason I made this tool open source was to hopefully get some other smart Jews to contribute (wink wink). Oren is right, that the framework currently only supports Win Forms (as that is what I'm using day to day), but as you can see in the code snippet, I've left it open for extension. So currently, the 'FormDemonstrator' extends the 'Demonstrator' class. A WebDemonstrator class would probably be fairly easy to write. DevTeach rocked, you had great talks... and the songs were hilarious! L'Chaim -Ben