Test Driven Development with Windows Phone 7

With the Windows Phone Marketplace, user feedback and ratings are supremely important. One annoying bug can mean the difference between a 5-star rated, top-selling app, and a mediocre seller. Test Driven Development gives us a developers an assurance that our apps are internally consistent and perform properly, especially as we add new features and releases to existing applications.

I’ve been hunting around for a good way to use TDD in the Windows Phone 7 world. They core issue is that if we are testing things like phone APIs and IsolatedStorage, the tests themselves obviously have to run on the emulator. Thankfully, Jeff Wilcox has extended the Silverlight unit testing framework with a Windows Phone 7 version. It even has a basic UI so you can see your test results on the emulator.

If you have any interest in learning how to use this test framework in a robust TDD approach for Windows Phone development (and you should), David Gadd’s Windows Phone TDD Kata is an awesome starting point. The kata also covers MVVM and touches on Domain Driven Development. All of these things rolled together will ensure that you can output high-quality, bug-free applications that delight users and end up with great ratings.

Join the Conversation

5 Comments

  1. Why would you unit test the phone API’s and isolated storage?! They are not under your control, so abstract them away

    1. Firstly, it’s an entirely specific runtime on the phone, so we have no choice but to unit test on-device (or on-emulator)

      In my specific case I’m testing things like extracting a file from isolated storage and using a custom unzip class to read the file header. I guess I could theoretically abstract away IsoStore by providing a “mock” zip filestream, but there’s pure TDD and then theres masochism 🙂

      1. Oooh interesting about the specific runtime on the phone, I may have to do some reading about that!

        Masochism FTW 😛

Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: