| Comments

If you are a developer who likes various aspect of testing in your application (beyond the “does it work” testing), you may be interested in a few frameworks for Silverlight.

Microsoft Silverlight Unit Test Framework

This testing framework was developed by Jeff Wilcox of the Silverlight Toolkit fame among other things.  This test framework is used by the Silverlight Toolkit team themselves (as is what is shipped with the source code for the project).  This framework runs unit test inside the browser and includes the ability to test rich controls as well as the entire Silverlight platform.

Jeff has a great blog post which includes a video walk-through of this test framework.  Check it out: Silverlight Unit Test Framework.


Just yesterday, Roy Osherove released SilverUnit, which he describes as

a new open source unit testing framework for Silverlight (true unit testing, not the Integration style, browser-backed, async-driven C#-only-friendly, monster of a Test Framework…”

Hmm, maybe we should have a death match at MIX between Jeff and Roy :-).  Reading the more detailed information about SilverUnit, Roy further describes:

You can run then as a regular NUnit test run, they run only in memory. The CThru engine underneath takes care of intercepting and “skipping” all calls to the silverlight runtime. SilverUnit does its part and mimics the missing pieces (Dependency Properties, RoutedEvents to a degree and so on).

The project is hosted on CodePlex as a part of the CThru project and you can get the bits and some demonstration there: SilverUnit.


My friend Ted Neward turned me on to something new today: Silverlight-Selenium.  For those who don’t know Selenium, it is a very awesome web application testing framework, that is a bit of unit tests and a bit automation testing.  I personally have used Selenium for simulation of end-user interaction testing in web applications.  I think the framework is great and comes with some good tools to help record tests and automate the creation of scripts…but enough about that.

The new project extends Selenium a bit adding the ability for Silverlight communication.  If you are familiar with Selenium, you know that it uses JavaScript to communicate with the browser.  In order for this extension to Selenium to work with Silverlight, your code needs to be exposed as scriptable objects.  This is the only thing I see problematic with this framework.  I’m not sure that having a separate build for testing to add the [Scriptable] attributes will be palatable to most, but I’m sure there is some #IF DEBUG type stuff you could do to make that easier.

This project also includes “silvernium” (not sure that’s an actual element is it? ;-) in order to communicate with the Silverlight object model without you having to worry about that part.  This is an interesting project to watch.


Testing and patterns of testing vary.  I’ve seen many religious debates about TDD and what people think is right/wrong/whatever.  I’m not here to say anything on that – but that if you are testing beyond compiling and playing with it, that you should look at these types of frameworks evolving…they are easy to use and should be great additions to your development lifecycle. 

What else have you seen for Silverlight testing?

| Comments

what is windmill?  it is described as:

Project Windmill was created with the intention of reaching 100% automated testing of heavy Ajax web applications after trying desperately to make existing solutions work.

i'm eager to listen to this one.  i've used selenium as a web testing UI platform in the past and like a lot of what it offers...i'm expecting to see what windmill provides better/different and if it is more simplistic...here we go.

the guys behind this are mikeal rogers and adam christian of the cosmos web project(?) which is now the chandler server project.

so adam first is showing the demonstration of windmill testing the calendar feature of the chandler server -- showing automated testing of ajaxy drag/drop features, etc.  he points to a window that is open, calling it the 'windmill ide' which looks like.

requirements for the project:

    • run single test on all target browsers
    • easily debug tests
    • easily fit into continuous integration

why windmill?

    • needed to test heavy ajax application which changed dramatically
    • existing solutions (selenium) didn't fill all reqs
    • debugging/test authoring was difficult
    • CI integration was a pain
    • extending libraries wasn't easy

architecture... the service is completely written in python, ide is javascript and the test authoring library is anything.

what can be automated?

    • OOTB support for: open, click, check, radio, wait, type, doubleClick, select, dragDrop
    • all controller actions support a unified 'locator' to reference UI elements supporting xpath, link, name, id, and jsid (calls a javascript function which returns an element id).

the ide features:

    • multi-browser test recorder
    • multiple layers of support for perf info and metrics
    • DOM explorer (much like firebug, but multibrowser)
    • javascript shell (thank you mochikit)

service features:

    • extensible logging
    • 3 run modes: headless command line; shell mode; wx GUI
    • browsing launching and configuration
    • server level pre and post hooks for result parsing

these guys are working diligently on end-user docs and getting information out.  they know there may be bugs, and are hoping people use it and find them -- they are quick to respond right now.

adam is demonstrating this in action right now...recorder looks cool, ide looks good, they did a good job here, you should check it out!