×

First time here?

You are looking at the most recent posts. You may also want to check out older archives. Please leave a comment, ask a question and consider subscribing to the latest posts via RSS or email. Thank you for visiting!

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.

SilverUnit

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.

Selenium

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.

Summary

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?


This work is licensed under a Creative Commons Attribution By license.



DISCLAIMER:

The opinions/content expressed on this blog are provided "ASIS" with no warranties and are my own personal opinions/content (unless otherwise noted) and do not represent my employer's view in any way.