Test Driving My Windows Phone 7 App

Published July 24, 2011 by Toran Billups

I recently started building my first WP7 app and found that most of the community seems to be 'okay' with running tests through the emulator instead of a normal test runner like ReSharper. And as someone who can't design software anymore without thinking test-first I had to come up with a way to test drive my app or I wouldn't have much success on the platform.

I initially played around with the Silverlight NUnit Project Visual Studio Template but it didn't work right out of the box as I had hoped. But not because Jamie Cansdale wasn't thinking ahead, instead the latest version of ReSharper (6.0) has a bug in the test runner causing my tests to not go green (or red for that matter). So after a week without tdd, I went to the community for help ... but I still didn't find the answer I was looking for.

Finally I decided to research and blog about the working solution I came up with that allowed me to practice tdd again on the platform. The video is 16 minutes long and I hope someone as frustrated as I was will find it helpful.

Direct Download (mp4)

For anyone who isn't interested in the short video I basically took the NUnit dll from the Silverlight NUnit Project and added it to a new WP7 Class Library. From here I had to downgrade my version of ReSharper to 5.x (until the test runner gets a patch). And finally if you come across the 'assembly xyz is missing' during a unit test be sure you mark the dependency as 'Copy Local - True'

If anyone wants the nunit dll I used in the project it's available here for direct download.


Buy Me a Coffee

Twitter / Github / Email