Windows 8 Development - Continuous Integration

17 June 2014

Continuous integration (CI) is one of those practices that is a necessity for me on all of my projects. Without the tight feedback loops that CI gives you, projects feel unprofessional to me. This has been a point of frustration for me while developing for Windows 8 with JavaScript. Building the solution can easily be done with MSBuild. But, unit testing has been a bit of a problem.


For compiling, I have been a huge fan of Albacore for the last year or so. Ruby/Rake is easy to learn and the build scripts are easy to read and maintain.

 1 require 'albacore'
 3 task :default => [:build]
 5 Albacore.configure do |config|
 6   config.msbuild.command = "C:/Program Files (x86)/MSBuild/12.0/Bin/MSBuild.exe"
 7   config.msbuild.verbosity = 'Minimal'
 8 end
10 desc "Compile solution"
11 msbuild :build do |msb|
12  msb.solution = "2014-TechFest.sln"
13  msb.targets :clean, :build
14 :configuration => :release, :platform => :x64
15  msb.nologo
16 end

Unit Testing JavaScript

For the most part, I have found WinJS to be tightly coupled and difficult to test. To address this, instead of building functionality into the page object, I've found it necessary to build out a separate object model that can be tested via Jasmine and executed on the CI server via Jasmine Gem.

Unit Testing C# Components

As I mentioned in a previous post, I initially attempted to use C# components for doing the heavy lifting in my application. This caused a lot of issues with regard to unit testing because of the different run-times. I normally prefer NUnit and Specflow, but neither of them support WinRT. I have read that you can use XUnit, but I have not had any success with getting it to work. This means that you are pretty much forced to use MSTest. However, even with a testing framework that works with the target runtime, all of the restrictions placed on C# components makes it nearly impossible to test them anyway. This is the major reason that I recommend sticking with only using JavaScript.