Geeks With Blogs

News Locations of visitors to this page

Brian Genisio's House of Bilz
Shout it kick it on

I was recently asked by someone on Twitter to describe my setup for writing tests against my Silverlight application.  I thought I would write them down here in case others might find this information useful.

Testing Framework: A slightly modified version of NUnit that works with SIlverlight.

Mocking Framework: Moq 3.0 includes support for Silverlight.  This is my favorite mocking framework, so I am happy that it now supports Silverlight.

Test Runner: I use TestDriven.NET to run all of my tests locally.  I use Cruise Control to run the tests on the “Continuous Integration” system.

Making testing easier: This is not specific to Silverlight testing, but I use ReSharper templates that I have customized to aid in writing tests quickly.

The MVVM Pattern: This is not a tool, but I the majority of my SIlverlight code would be un-testable if I didn’t know the MVVM pattern.  I highly recommend using this pattern with Silverlight.  None of the view code can be tested using NUnit, so testing the ViewModel is essential.

UI Automation: I am just starting to play with this.  White is a layer on top of Microsoft’s UI Automation (UIA) framework.  UIA is much to hard to use without a “helper” layer.  It lets you run fully automated UI tests.  I only want to use this to make sure my data bindings are correct.  My unit tests are really the bulk of my testing efforts.

Posted on Saturday, March 28, 2009 11:28 PM | Back to top

Comments on this post: My Silverlight Testing Rig

# re: My Silverlight Testing Rig
Requesting Gravatar...
Disclaimer – I work for Typemock…

Note that Roy Osherove has released an open source tool for Unit testing Silverlight called SilverUnit. This tool sits on top of Typemock Isolator.

You can learn more about it here :
Left by Mo on Apr 03, 2009 5:03 AM

# re: My Silverlight Testing Rig
Requesting Gravatar...

Thanks for the alternative. My personal opinion falls towards not using TypeMock. I am not a huge fan of the approach to mocking that TypeMock takes, but that is just me.

I do like, however, that DependencyObjects work in SilverUnit. With my approach, I have to abstract the framework myself, which means wrappers around everything that derives from DependencyObject. It is not horrible, but I wish I didn't have to abstract out things like MouseEventArgs and KeyEventArgs. TypeMock/SilverUnit does a great job of doing this for you.

However, the price of TypeMock is prohibitive for me... and I choose free tools that are (almost) equally as powerful.
Left by Brian Genisio on Apr 03, 2009 5:52 AM

# re: My Silverlight Testing Rig
Requesting Gravatar...
Our tool might be interesting for you.

We provide a GUI testing solution for Silverlight applications.
You can capture and replay your GUI testing and generate C#, VB.NET and IronPython code.

Here you can download a free trial:
Left by Gherget on Jul 24, 2009 4:45 AM

# re: My Silverlight Testing Rig
Requesting Gravatar...

Thanks for the link. I have, indeed played with Ranorex (for winforms) in the past. It is a nice library. An alternative to Ranorex is the "Windows Automation Framework" with the "White" library on top of it.

In either case, the tools are geared towards functional testing... bring the app up, and start automating the pression of buttons.

My blog post is geared towards UNIT tests, which requires a completely different approach. Both types of tests are useful, but it is important to distinguish between the two as separate approaches.
Left by Brian Genisio on Jul 26, 2009 7:18 PM

# davetiyeci
Requesting Gravatar...
güzel davetiye sözleri davetiye modelleri düğün davetiyeleri
Left by davetiye on Nov 02, 2009 1:55 AM

Your comment:
 (will show your gravatar)

Copyright © Brian Genisio's House Of Bilz | Powered by: