I am putting this out there to see if I can get some traction with other Test Driven Silverlight coders out there. If you are one of these people you will know of the strife your day-to-day coding. For those who don’t know what I mean these are the three options a Silverlight developer has with regards to test driven coding:
1) Use the Silverlight Unit Test Framework. The problem with this is that you lose any integrated development support, it is amazingly slow (in the area of 1-5 tests per second), and doesn’t have any useful build tool support (coverage, TFS, TeamCity). Massive Fail.
2) Cross compile to .NET 4 all of your Models, ViewModels, Controllers, Modules, Presenters (i.e. everything that is not a View or a Control). Now write unit tests against this project. This means you get back to fast tests (100s tests per second) but take a hit on compiling twice and managing the project linking and just having twice as many projects floating around.
3) What I imagine as the most popular option, just don’t write any tests.
Looking at what most of the requests are for, tells me most people are using Silverlight for Marketing websites to stream rich content. Business applications have yet to stake any dominance. What I am hoping that anyone reading this will if they feel my pain, just go to this link and vote. It seems that these polls really have an effect; DataTemplates appear to be part of SL 5 due to massive demand. I am hoping that Microsoft can focus on getting the underlying framework right before they go off and give us a 3D-multitouch-proximity aware API 🙂
I haven't done any work with Silverlight for years, but I did write this blog post a while ago about Silverlight testing when I was playing with it.
Might be of use
My team tried the SL Unit Testing framework and found it unusable for the reasons you listed. We are now using http://code.google.com/p/nunit-silverlight/ with a lot of success, including integration with our TFS build using http://nunit4teambuild.codeplex.com/