As I started learning about writing JavaScript apps for Windows 8, I progressed through a few sample projects and found my way easily. After all, I’ve been writing HTML and JavaScript for the past 10 years… this shouldn’t be difficult. I did however find that my practice of Test Driven Development to be nearly impossible to achieve. You see, out of the box, Visual Studio 2012 and Windows 8 do NOT provide for unit testing your JavaScript. However, if you opt to write your app in XAML, unit testing is available.
This was unacceptable, so I went to the drawing board. I dug up my favorite unit test framework, QUnit and started to work with QUnit to test my sample Windows 8 projects. Alas, QUnit expects to run in a browser and have full access to the DOM. For those of you who have not developed a Metro app yet, you will find that DOM manipulation is very hard to do.
So, <TimAllenVoice>I re-wrote it!</TimAllenVoice> I have forked QUnit 1.5 and added some bindings to get it working in the Metro environment. The result is something that I call “QUnit-Metro”.
By the time this post is published, I will have presented the framework at Tech Ed 2012’s Speaker Idol competition. This is a very exciting time for me, as I have never presented at Tech Ed before. Sure, I’ve done Code Camps and local user groups, but never anything of the size of Tech Ed. My hands are trembling with excitement as I type this post from the conference floor, mere hours before the competition starts.
I will post screenshots, a starter tutorial, and a quick screencast showing the framework over the next day or two. For now, check out QUnit-Metro at:
Thanks for reading…. and I’ll update you with more Metro and Unit testing goodness over the next few months.