Hawaiʻi's Technology Community

Having spent a year in the Ruby on Rails world, I had become accustomed to coding in a BDD/TDD fashion. Ultimately, I craved my type safety and came back to .NET ready to apply these same proven principles to WPF and Silverlight development. No worries, I thought;  I had used NUnit before going to rails and, upon return, had discoveredStoryQ (a BDD framework) which integrates nicely with NUnit.


One last piece of the puzzle was the nice separation of concerns when using the MVVM pattern inside of Prism for composite application building.  The separation allows the full unit testing of models and view models without the GUI stuff getting in the way.  I completed a couple of WPF applications with this technology stack and felt things were progressing nicely.  And then...


My next project was a Silverlight 4 Prism application.  I created a test project but nothing worked.  Consulting Google (the mighty and powerful knower of all things), I found that I needed the Silverlight Toolkit to make everything work.  Once installed, I was presented with a template for creating a Silverlight Test Application. This just creates a new Silverlight 4 application with references to the Microsoft.Silverlight.Testing.dll and the Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll -- both of which are necessary to integrate Microsoft's testing framework into your Silverlight application and both of which can be found in the Silverlight Toolkit. 


Additionally, the template adds an .aspx page to your web application which hostss your Silverlight application.  This page, when set as the start page, hosts the Silverlight test harness.  When loaded, the harness through all your tests and provides pass/fail feedback.  I'm still making my way through the API for testing but one nice feature is the TagAttribute.  Place it on any test method and choose a name for the tag.  When the test harness cranks up, it will ask you if you want to run all tests or just those that are tagged.  This can greatly increase your productivity when you don't need to run the entire test suite.


There are a few features to be added yet.  For one, better feedback about the location of failures would be useful.  But overall, it is indispensable for anyone dedicated to TDD (and if your not dedicated to TDD, you're just wasting time). Now, if only JetBrains would build a test runner...

Views: 177


You need to be a member of TechHui to add comments!

Join TechHui

Comment by Calin West on March 24, 2011 at 12:17am
Interesting. I'm going to give this a try on our current project.


web design, web development, localization

© 2022   Created by Daniel Leuck.   Powered by

Badges  |  Report an Issue  |  Terms of Service